List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:com.peterbochs.instrument.InstrumentPanel.java
private JTabbedPane getJTabbedPane2() { if (jTabbedPane2 == null) { jTabbedPane2 = new JTabbedPane(); {//from w w w . j a v a 2 s.c o m jfcMemory = createEmptyChart(createEmptyDataset()); jMemoryChartPanel = new ChartPanel(jfcMemory); jTabbedPane2.addTab("Chart", null, jMemoryChartPanel, null); jTabbedPane2.addTab("3D Chart", null, getJPanel14(), null); jMemoryChartPanel.setDisplayToolTips(true); jfcMemory.addChangeListener(this); jMemoryChartPanel.addChartMouseListener(this); } } return jTabbedPane2; }
From source file:org.biojava.bio.view.MotifAnalyzer.java
public void displayCharts(int chartNum) throws IOException { JFrame chartsFrame = new JFrame("Charts Analysis" + chartNum); chartsFrame.setSize(700, 600);//from ww w .j ava 2 s. co m JTabbedPane tabs = new JTabbedPane(); chartsFrame.add(tabs); String dataset = ((Dataset) datasetComboBox.getSelectedItem()).name(); //tabs.addTab("Log", getOutputTextPane(log)); tabs.addTab("Statistics", new JScrollPane(getStatisticsTab(chartNum))); String[] chartsNames = FileNames.getCharts(chartNum); for (int i = 0; i < chartsNames.length; i++) { JPanel image1 = new JPanel(new BorderLayout()); image1.add(new JLabel(new ImageIcon(ImageIO.read(new File(chartsNames[i]))))); image1.setBackground(Color.white); tabs.addTab("Chart " + (i + 1) + "(" + dataset + ")", image1); } chartsFrame.setVisible(true); }
From source file:org.biojava.bio.view.MotifAnalyzer.java
public void displayCharts(String fileName) throws IOException { JFrame chartsFrame = new JFrame("Charts Analysis"); chartsFrame.setSize(700, 600);/*w ww.j a va 2 s .com*/ JTabbedPane tabs = new JTabbedPane(); chartsFrame.add(tabs); JPanel image1 = new JPanel(new BorderLayout()); image1.add(new JLabel(new ImageIcon(ImageIO.read(new File(fileName))))); image1.setBackground(Color.white); tabs.addTab("Chart ", image1); chartsFrame.setVisible(true); }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Place the components in the JFrame/*ww w . ja v a 2 s. co m*/ */ private void setupGUI() { JPanel panel; LOGGER.debug("SetupGUI"); setupControls(); setupMenus(); getContentPane().setLayout(new BorderLayout()); panel = new JPanel(); panel.setLayout(new BorderLayout()); getContentPane().add(panel, BorderLayout.CENTER); tabbedPane = new JTabbedPane(); // Assertions tabbedPane.add("Assertions", setupAssertionsPanel()); // Inferences tabbedPane.add("Inferences", setupInferencesPanel()); // Tree view tabbedPane.add("Tree View", setupTreePanel()); // SPARQL tabbedPane.add("SPARQL", setupSparqlPanel()); // Detect tab selections tabbedPane.addChangeListener(new TabbedPaneChangeListener()); // Add the tabbed pane to the main window panel.add(tabbedPane, BorderLayout.CENTER); // Status label, bottom of window panel.add(setupStatusPanel(), BorderLayout.SOUTH); }
From source file:com.marginallyclever.makelangelo.MainGUI.java
public Container CreateContentPane() { //Create the content-pane-to-be. JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setOpaque(true);//from w w w . j ava 2 s .com // the log panel log = new JTextPane(); log.setEditable(false); log.setBackground(Color.BLACK); logPane = new JScrollPane(log); kit = new HTMLEditorKit(); doc = new HTMLDocument(); log.setEditorKit(kit); log.setDocument(doc); DefaultCaret c = (DefaultCaret) log.getCaret(); c.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); ClearLog(); settingsPane = SettingsPanel(); previewPane = new DrawPanel(machineConfiguration); preparePane = ProcessImages(); driveControls = new MakelangeloDriveControls(); driveControls.createPanel(this, translator, machineConfiguration); driveControls.updateButtonAccess(false, false); statusBar = new StatusBar(translator); contextMenu = new JTabbedPane(); contextMenu.addTab(translator.get("MenuSettings"), null, settingsPane, null); contextMenu.addTab(translator.get("MenuGCODE"), null, preparePane, null); contextMenu.addTab(translator.get("MenuDraw"), null, driveControls, null); contextMenu.addTab("Log", null, logPane, null); // major layout split_left_right = new Splitter(JSplitPane.HORIZONTAL_SPLIT); split_left_right.add(previewPane); split_left_right.add(contextMenu); contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(split_left_right, BorderLayout.CENTER); return contentPane; }
From source file:com.pianobakery.complsa.MainGui.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL/*from w ww .j a v a2 s. com*/ */ private void $$$setupUI$$$() { createUIComponents(); mainPanel = new JPanel(); mainPanel.setLayout(new FormLayout("fill:max(m;620px):grow", "center:max(m;600px):grow")); tabbedPane1 = new JTabbedPane(); tabbedPane1.setEnabled(true); CellConstraints cc = new CellConstraints(); mainPanel.add(tabbedPane1, cc.xy(1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); setupPanel = new JPanel(); setupPanel.setLayout(new FormLayout( "fill:d:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:126px:noGrow,fill:max(d;4px):noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:5dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:52px:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,fill:d:grow,fill:d:grow,fill:66px:noGrow", "center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow")); tabbedPane1.addTab("Project", setupPanel); newFolderButton = new JButton(); newFolderButton.setText("New Folder"); setupPanel.add(newFolderButton, cc.xy(1, 5)); final JLabel label1 = new JLabel(); label1.setText("Project Folder:"); setupPanel.add(label1, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); selectFolderButton = new JButton(); selectFolderButton.setText("Select Folder"); setupPanel.add(selectFolderButton, cc.xy(5, 5)); wDirText = new JTextField(); wDirText.setEditable(false); wDirText.setText("Create or select Project Folder"); setupPanel.add(wDirText, cc.xyw(7, 5, 48, CellConstraints.FILL, CellConstraints.DEFAULT)); final JLabel label2 = new JLabel(); label2.setText("The Project Folder contains all the Project Data."); setupPanel.add(label2, cc.xyw(1, 3, 54)); final JLabel label3 = new JLabel(); label3.setText("Arrange your Documents in a Folder. Then add it to the Software."); setupPanel.add(label3, cc.xyw(1, 15, 54)); downloadModelButton = new JButton(); downloadModelButton.setText("Download Models"); setupPanel.add(downloadModelButton, cc.xy(1, 9)); final JLabel label4 = new JLabel(); label4.setText("Language Models:"); setupPanel.add(label4, cc.xy(5, 9)); langModelsText = new JLabel(); langModelsText.setText(""); setupPanel.add(langModelsText, cc.xyw(7, 9, 48)); trainCorpButton = new JButton(); trainCorpButton.setText("Train Semantics"); setupPanel.add(trainCorpButton, cc.xy(1, 33, CellConstraints.FILL, CellConstraints.DEFAULT)); final JLabel label5 = new JLabel(); label5.setText("Create Semantic Knowledge with selected Training Corpus:"); setupPanel.add(label5, cc.xyw(1, 25, 7)); addTopicCorpusButton = new JButton(); addTopicCorpusButton.setEnabled(true); addTopicCorpusButton.setText(" Add Corpus Folder"); setupPanel.add(addTopicCorpusButton, cc.xy(1, 19)); addCorpRecursiveCheckBox = new JCheckBox(); addCorpRecursiveCheckBox.setSelected(true); addCorpRecursiveCheckBox.setText("Recursive"); setupPanel.add(addCorpRecursiveCheckBox, cc.xy(5, 19)); createChunksCheckBox = new JCheckBox(); createChunksCheckBox.setSelected(true); createChunksCheckBox.setText("Split in Paragraph of:"); setupPanel.add(createChunksCheckBox, cc.xy(7, 19)); final JLabel label6 = new JLabel(); label6.setText("Add/Remove Training Corpus:"); setupPanel.add(label6, cc.xyw(1, 17, 5)); final JLabel label7 = new JLabel(); label7.setText("Select Training Corpus:"); setupPanel.add(label7, cc.xyw(1, 21, 54)); selectTrainCorp = new JComboBox(); selectTrainCorp.setEnabled(true); setupPanel.add(selectTrainCorp, cc.xyw(1, 23, 5)); removeTopicCorpusButton = new JButton(); removeTopicCorpusButton.setEnabled(true); removeTopicCorpusButton.setHorizontalAlignment(2); removeTopicCorpusButton.setText("Remove Training Corpus"); setupPanel.add(removeTopicCorpusButton, cc.xy(7, 23)); setupPanel.add(indexTypeComboBox, cc.xy(7, 33)); amountOfSentencesPerTextField = new JTextField(); amountOfSentencesPerTextField.setHorizontalAlignment(2); amountOfSentencesPerTextField.setText("20"); setupPanel.add(amountOfSentencesPerTextField, cc.xyw(9, 19, 6, CellConstraints.FILL, CellConstraints.DEFAULT)); posIndRadiusTextField = new JTextField(); posIndRadiusTextField.setHorizontalAlignment(2); posIndRadiusTextField.setText("20"); setupPanel.add(posIndRadiusTextField, cc.xyw(9, 33, 6, CellConstraints.FILL, CellConstraints.DEFAULT)); final JLabel label8 = new JLabel(); label8.setText("Indextype:"); setupPanel.add(label8, cc.xy(5, 33, CellConstraints.RIGHT, CellConstraints.DEFAULT)); final JLabel label9 = new JLabel(); label9.setHorizontalAlignment(2); label9.setText("Sentences"); setupPanel.add(label9, cc.xy(15, 19)); final JLabel label10 = new JLabel(); label10.setHorizontalAlignment(2); label10.setText("Words"); setupPanel.add(label10, cc.xy(15, 33)); setupPanel.add(termComboBox, cc.xyw(31, 33, 19)); final JLabel label11 = new JLabel(); label11.setText("Termweight:"); setupPanel.add(label11, cc.xyw(18, 33, 13)); updateIndexButton = new JButton(); updateIndexButton.setText("Update Index"); setupPanel.add(updateIndexButton, cc.xy(1, 29)); removeIndexButton = new JButton(); removeIndexButton.setText("Remove Index"); setupPanel.add(removeIndexButton, cc.xy(5, 29)); final JLabel label12 = new JLabel(); label12.setText("Add/Remove Search Corpus:"); setupPanel.add(label12, cc.xyw(1, 41, 5)); impSearchCorpButton = new JButton(); impSearchCorpButton.setText("Add Search Corpus"); setupPanel.add(impSearchCorpButton, cc.xy(1, 43)); impSearchCorpRecursiveCheckBox = new JCheckBox(); impSearchCorpRecursiveCheckBox.setSelected(true); impSearchCorpRecursiveCheckBox.setText("Recursive"); setupPanel.add(impSearchCorpRecursiveCheckBox, cc.xy(5, 43)); splitSearchCorpCheckBox = new JCheckBox(); splitSearchCorpCheckBox.setSelected(true); splitSearchCorpCheckBox.setText("Split in Paragraph of:"); setupPanel.add(splitSearchCorpCheckBox, cc.xy(7, 43)); amountSearchCorpSent = new JTextField(); amountSearchCorpSent.setHorizontalAlignment(2); amountSearchCorpSent.setText("20"); setupPanel.add(amountSearchCorpSent, cc.xyw(9, 43, 6, CellConstraints.FILL, CellConstraints.DEFAULT)); final JLabel label13 = new JLabel(); label13.setHorizontalAlignment(2); label13.setText("Sentences"); setupPanel.add(label13, cc.xy(15, 43)); searchCorpComboBox = new JComboBox(); setupPanel.add(searchCorpComboBox, cc.xyw(1, 47, 5, CellConstraints.DEFAULT, CellConstraints.TOP)); removeSearchCorpButton = new JButton(); removeSearchCorpButton.setText("Remove Search Corpus"); setupPanel.add(removeSearchCorpButton, cc.xy(7, 47)); final JLabel label14 = new JLabel(); label14.setText("Select Search Corpus:"); setupPanel.add(label14, cc.xyw(1, 45, 5)); final JLabel label15 = new JLabel(); label15.setText("Arrange your Search Corpus in a Folder. Then add it to the Software. "); setupPanel.add(label15, cc.xyw(1, 39, 54)); final JLabel label16 = new JLabel(); label16.setText("First update the Index."); setupPanel.add(label16, cc.xyw(1, 27, 5)); final JLabel label17 = new JLabel(); label17.setText( "Then select an Algorithm and train the Software. On the Search Tab you can select the Algorithms to run your semantic searches."); setupPanel.add(label17, cc.xyw(1, 31, 54)); final JLabel label18 = new JLabel(); label18.setText("Download Language Models:"); setupPanel.add(label18, cc.xyw(1, 7, 54)); final JLabel label19 = new JLabel(); label19.setText("Training Corpora:"); setupPanel.add(label19, cc.xyw(1, 13, 54)); final JLabel label20 = new JLabel(); label20.setText("Search Corpora:"); setupPanel.add(label20, cc.xyw(1, 37, 54)); final JLabel label21 = new JLabel(); label21.setEnabled(true); label21.setText(" "); setupPanel.add(label21, cc.xy(1, 11)); final JLabel label22 = new JLabel(); label22.setText(" "); setupPanel.add(label22, cc.xy(1, 35)); searchDocs = new JPanel(); searchDocs.setLayout(new FormLayout( "left:4dlu:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:277px:noGrow,left:4dlu:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(m;400px):grow,left:4dlu:noGrow,fill:max(m;200px):grow", "center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,top:3dlu:noGrow,center:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:243px:grow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:38px:noGrow,top:3dlu:noGrow")); searchDocs.setEnabled(true); tabbedPane1.addTab("Search", searchDocs); final JLabel label23 = new JLabel(); label23.setText("Choose Semantic Knowledge Algorithm:"); searchDocs.add(label23, cc.xyw(3, 1, 5)); final JLabel label24 = new JLabel(); label24.setText("Enter Search Text or select Search Document:"); searchDocs.add(label24, cc.xyw(3, 20, 5)); final JLabel label25 = new JLabel(); label25.setText("Document Search Results:"); searchDocs.add(label25, cc.xyw(10, 1, 3)); final JLabel label26 = new JLabel(); label26.setText("Selection Metadata:"); searchDocs.add(label26, cc.xyw(10, 27, 3)); selectIndexTypeComboBox = new JComboBox(); searchDocs.add(selectIndexTypeComboBox, cc.xyw(7, 10, 3)); final JLabel label27 = new JLabel(); label27.setText("Index Type:"); searchDocs.add(label27, cc.xy(7, 8)); final JLabel label28 = new JLabel(); label28.setText("Termweight:"); searchDocs.add(label28, cc.xy(7, 12)); selectTermweightComboBox = new JComboBox(); searchDocs.add(selectTermweightComboBox, cc.xy(7, 14)); final JLabel label29 = new JLabel(); label29.setText("Number of search results:"); searchDocs.add(label29, cc.xy(7, 16)); noOfSearchResultsText = new JTextField(); noOfSearchResultsText.setText("20"); searchDocs.add(noOfSearchResultsText, cc.xy(7, 18, CellConstraints.FILL, CellConstraints.DEFAULT)); final JScrollPane scrollPane1 = new JScrollPane(); searchDocs.add(scrollPane1, cc.xywh(7, 22, 1, 2, CellConstraints.FILL, CellConstraints.FILL)); searchTextArea = new JTextArea(); searchTextArea.setLineWrap(true); searchTextArea.setText(""); searchTextArea.setWrapStyleWord(true); scrollPane1.setViewportView(searchTextArea); selTextRadioButton = new JRadioButton(); selTextRadioButton.setSelected(true); selTextRadioButton.setText(""); searchDocs.add(selTextRadioButton, cc.xy(5, 22)); algTextField = new JLabel(); algTextField.setText("Knowledge Corpus: null"); searchDocs.add(algTextField, cc.xy(7, 3, CellConstraints.DEFAULT, CellConstraints.FILL)); selectDocumentButton = new JButton(); selectDocumentButton.setEnabled(false); selectDocumentButton.setText("Select Document"); searchDocs.add(selectDocumentButton, cc.xy(7, 25)); selDocRadioButton = new JRadioButton(); selDocRadioButton.setText(""); searchDocs.add(selDocRadioButton, cc.xy(5, 25)); final JLabel label30 = new JLabel(); label30.setText("Select Corpus to Search:"); searchDocs.add(label30, cc.xyw(3, 30, 5)); searchTopCorpRadioButton = new JRadioButton(); searchTopCorpRadioButton.setSelected(true); searchTopCorpRadioButton.setText("Topic Corpus"); searchDocs.add(searchTopCorpRadioButton, cc.xy(7, 32, CellConstraints.DEFAULT, CellConstraints.TOP)); searchSearchCorpRadioButton = new JRadioButton(); searchSearchCorpRadioButton.setSelected(false); searchSearchCorpRadioButton.setText("Search Corpus"); searchDocs.add(searchSearchCorpRadioButton, cc.xy(7, 34, CellConstraints.DEFAULT, CellConstraints.TOP)); searchButton = new JButton(); searchButton.setText("Search"); searchDocs.add(searchButton, cc.xy(7, 36)); final JScrollPane scrollPane2 = new JScrollPane(); searchDocs.add(scrollPane2, cc.xywh(10, 30, 3, 7, CellConstraints.FILL, CellConstraints.FILL)); metadataTextField = new JTextArea(); metadataTextField.setEditable(false); scrollPane2.setViewportView(metadataTextField); termTablePane = new JScrollPane(); termTablePane.setEnabled(true); termTablePane.setVerticalScrollBarPolicy(22); searchDocs.add(termTablePane, cc.xywh(14, 3, 1, 21, CellConstraints.FILL, CellConstraints.FILL)); termSearchResTable.setAutoCreateRowSorter(true); termSearchResTable.setAutoResizeMode(2); termSearchResTable.setFillsViewportHeight(false); termSearchResTable.setForeground(new Color(-16777216)); termTablePane.setViewportView(termSearchResTable); docTablePane = new JScrollPane(); docTablePane.setVerticalScrollBarPolicy(22); searchDocs.add(docTablePane, cc.xywh(10, 3, 3, 21, CellConstraints.FILL, CellConstraints.FILL)); docSearchResTable.setAutoCreateRowSorter(true); docTablePane.setViewportView(docSearchResTable); final JLabel label31 = new JLabel(); label31.setText("Term Search Result:"); searchDocs.add(label31, cc.xy(14, 1)); searchDocValue = new JLabel(); searchDocValue.setText("nothing selected"); searchDocs.add(searchDocValue, cc.xyw(12, 25, 3, CellConstraints.LEFT, CellConstraints.DEFAULT)); openSearchDocumentButton = new JButton(); openSearchDocumentButton.setEnabled(false); openSearchDocumentButton.setText("Open Search Document"); searchDocs.add(openSearchDocumentButton, cc.xy(10, 25, CellConstraints.LEFT, CellConstraints.DEFAULT)); }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JTabbedPane getJTabbedPane3() { if (jTabbedPane3 == null) { jTabbedPane3 = new JTabbedPane(); jTabbedPane3.setPreferredSize(new java.awt.Dimension(730, 443)); jTabbedPane3.addTab("Config", null, getJCallGraphConfigPanel(), null); jTabbedPane3.addTab("Call graph", null, getJCallGraphPanel(), null); jTabbedPane3.addTab("Raw data", null, getJCallGraphTablePanel(), null); }/*from w w w.ja v a2 s. c o m*/ return jTabbedPane3; }
From source file:com.nikonhacker.gui.EmulatorUI.java
private void openChipOptionsDialog(final int chip) { // ------------------------ Disassembly options JPanel disassemblyOptionsPanel = new JPanel(new MigLayout("", "[left,grow][left,grow]")); // Prepare sample code area final RSyntaxTextArea listingArea = new RSyntaxTextArea(20, 90); SourceCodeFrame.prepareAreaFormat(chip, listingArea); final List<JCheckBox> outputOptionsCheckBoxes = new ArrayList<JCheckBox>(); ActionListener areaRefresherListener = new ActionListener() { public void actionPerformed(ActionEvent e) { try { Set<OutputOption> sampleOptions = EnumSet.noneOf(OutputOption.class); dumpOptionCheckboxes(outputOptionsCheckBoxes, sampleOptions); int baseAddress = framework.getPlatform(chip).getCpuState().getResetAddress(); int lastAddress = baseAddress; Memory sampleMemory = new DebuggableMemory(false); sampleMemory.map(baseAddress, 0x100, true, true, true); StringWriter writer = new StringWriter(); Disassembler disassembler; if (chip == Constants.CHIP_FR) { sampleMemory.store16(lastAddress, 0x1781); // PUSH RP lastAddress += 2;/*from w ww .j a v a 2 s.c om*/ sampleMemory.store16(lastAddress, 0x8FFE); // PUSH (FP,AC,R12,R11,R10,R9,R8) lastAddress += 2; sampleMemory.store16(lastAddress, 0x83EF); // ANDCCR #0xEF lastAddress += 2; sampleMemory.store16(lastAddress, 0x9F80); // LDI:32 #0x68000000,R0 lastAddress += 2; sampleMemory.store16(lastAddress, 0x6800); lastAddress += 2; sampleMemory.store16(lastAddress, 0x0000); lastAddress += 2; sampleMemory.store16(lastAddress, 0x2031); // LD @(FP,0x00C),R1 lastAddress += 2; sampleMemory.store16(lastAddress, 0xB581); // LSL #24,R1 lastAddress += 2; sampleMemory.store16(lastAddress, 0x1A40); // DMOVB R13,@0x40 lastAddress += 2; sampleMemory.store16(lastAddress, 0x9310); // ORCCR #0x10 lastAddress += 2; sampleMemory.store16(lastAddress, 0x8D7F); // POP (R8,R9,R10,R11,R12,AC,FP) lastAddress += 2; sampleMemory.store16(lastAddress, 0x0781); // POP RP lastAddress += 2; disassembler = new Dfr(); disassembler.setDebugPrintWriter(new PrintWriter(new StringWriter())); // Ignore disassembler.setOutputFileName(null); disassembler.processOptions(new String[] { "-m", "0x" + Format.asHex(baseAddress, 8) + "-0x" + Format.asHex(lastAddress, 8) + "=CODE" }); } else { sampleMemory.store32(lastAddress, 0x340B0001); // li $t3, 0x0001 lastAddress += 4; sampleMemory.store32(lastAddress, 0x17600006); // bnez $k1, 0xBFC00020 lastAddress += 4; sampleMemory.store32(lastAddress, 0x00000000); // nop lastAddress += 4; sampleMemory.store32(lastAddress, 0x54400006); // bnezl $t4, 0xBFC00028 lastAddress += 4; sampleMemory.store32(lastAddress, 0x3C0C0000); // ?lui $t4, 0x0000 lastAddress += 4; int baseAddress16 = lastAddress; int lastAddress16 = baseAddress16; sampleMemory.store32(lastAddress16, 0xF70064F6); // save $ra,$s0,$s1,$s2-$s7,$fp, 0x30 lastAddress16 += 4; sampleMemory.store16(lastAddress16, 0x6500); // nop lastAddress16 += 2; sampleMemory.store32(lastAddress16, 0xF7006476); // restore $ra,$s0,$s1,$s2-$s7,$fp, 0x30 lastAddress16 += 4; sampleMemory.store16(lastAddress16, 0xE8A0); // ret lastAddress16 += 2; disassembler = new Dtx(); disassembler.setDebugPrintWriter(new PrintWriter(new StringWriter())); // Ignore disassembler.setOutputFileName(null); disassembler.processOptions(new String[] { "-m", "0x" + Format.asHex(baseAddress, 8) + "-0x" + Format.asHex(lastAddress, 8) + "=CODE:32", "-m", "0x" + Format.asHex(baseAddress16, 8) + "-0x" + Format.asHex(lastAddress16, 8) + "=CODE:16" }); } disassembler.setOutputOptions(sampleOptions); disassembler.setMemory(sampleMemory); disassembler.initialize(); disassembler.setOutWriter(writer); disassembler.disassembleMemRanges(); disassembler.cleanup(); listingArea.setText(""); listingArea.append(writer.toString()); listingArea.setCaretPosition(0); } catch (Exception ex) { ex.printStackTrace(); } } }; int i = 1; for (OutputOption outputOption : OutputOption.allFormatOptions) { JCheckBox checkBox = makeOutputOptionCheckBox(chip, outputOption, prefs.getOutputOptions(chip), false); if (checkBox != null) { outputOptionsCheckBoxes.add(checkBox); disassemblyOptionsPanel.add(checkBox, (i % 2 == 0) ? "wrap" : ""); checkBox.addActionListener(areaRefresherListener); i++; } } if (i % 2 == 0) { disassemblyOptionsPanel.add(new JLabel(), "wrap"); } // Force a refresh areaRefresherListener.actionPerformed(new ActionEvent(outputOptionsCheckBoxes.get(0), 0, "")); // disassemblyOptionsPanel.add(new JLabel("Sample output:", SwingConstants.LEADING), "gapbottom 1, span, split 2, aligny center"); // disassemblyOptionsPanel.add(new JSeparator(), "span 2,wrap"); disassemblyOptionsPanel.add(new JSeparator(), "span 2, gapleft rel, growx, wrap"); disassemblyOptionsPanel.add(new JLabel("Sample output:"), "span 2,wrap"); disassemblyOptionsPanel.add(new JScrollPane(listingArea), "span 2,wrap"); disassemblyOptionsPanel.add(new JLabel("Tip: hover over the option checkboxes for help"), "span 2, center, wrap"); // ------------------------ Emulation options JPanel emulationOptionsPanel = new JPanel(new VerticalLayout(5, VerticalLayout.LEFT)); emulationOptionsPanel.add(new JLabel()); JLabel warningLabel = new JLabel( "NOTE: these options only take effect after reloading the firmware (or performing a 'Stop and reset')"); warningLabel.setBackground(Color.RED); warningLabel.setOpaque(true); warningLabel.setForeground(Color.WHITE); warningLabel.setHorizontalAlignment(SwingConstants.CENTER); emulationOptionsPanel.add(warningLabel); emulationOptionsPanel.add(new JLabel()); final JCheckBox writeProtectFirmwareCheckBox = new JCheckBox("Write-protect firmware"); writeProtectFirmwareCheckBox.setSelected(prefs.isFirmwareWriteProtected(chip)); emulationOptionsPanel.add(writeProtectFirmwareCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, any attempt to write to the loaded firmware area will result in an Emulator error. This can help trap spurious writes")); final JCheckBox dmaSynchronousCheckBox = new JCheckBox("Make DMA synchronous"); dmaSynchronousCheckBox.setSelected(prefs.isDmaSynchronous(chip)); emulationOptionsPanel.add(dmaSynchronousCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, DMA operations will be performed immediately, pausing the CPU. Otherwise they are performed in a separate thread.")); final JCheckBox autoEnableTimersCheckBox = new JCheckBox("Auto enable timers"); autoEnableTimersCheckBox.setSelected(prefs.isAutoEnableTimers(chip)); emulationOptionsPanel.add(autoEnableTimersCheckBox); emulationOptionsPanel .add(new JLabel("If checked, timers will be automatically enabled upon reset or firmware load.")); // Log memory messages final JCheckBox logMemoryMessagesCheckBox = new JCheckBox("Log memory messages"); logMemoryMessagesCheckBox.setSelected(prefs.isLogMemoryMessages(chip)); emulationOptionsPanel.add(logMemoryMessagesCheckBox); emulationOptionsPanel .add(new JLabel("If checked, messages related to memory will be logged to the console.")); // Log serial messages final JCheckBox logSerialMessagesCheckBox = new JCheckBox("Log serial messages"); logSerialMessagesCheckBox.setSelected(prefs.isLogSerialMessages(chip)); emulationOptionsPanel.add(logSerialMessagesCheckBox); emulationOptionsPanel.add( new JLabel("If checked, messages related to serial interfaces will be logged to the console.")); // Log register messages final JCheckBox logRegisterMessagesCheckBox = new JCheckBox("Log register messages"); logRegisterMessagesCheckBox.setSelected(prefs.isLogRegisterMessages(chip)); emulationOptionsPanel.add(logRegisterMessagesCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, warnings related to unimplemented register addresses will be logged to the console.")); // Log pin messages final JCheckBox logPinMessagesCheckBox = new JCheckBox("Log pin messages"); logPinMessagesCheckBox.setSelected(prefs.isLogPinMessages(chip)); emulationOptionsPanel.add(logPinMessagesCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, warnings related to unimplemented I/O pins will be logged to the console.")); emulationOptionsPanel.add(new JSeparator(JSeparator.HORIZONTAL)); // Alt mode upon Debug JPanel altDebugPanel = new JPanel(new FlowLayout()); Object[] altDebugMode = EnumSet.allOf(EmulationFramework.ExecutionMode.class).toArray(); final JComboBox altModeForDebugCombo = new JComboBox(new DefaultComboBoxModel(altDebugMode)); for (int j = 0; j < altDebugMode.length; j++) { if (altDebugMode[j].equals(prefs.getAltExecutionModeForSyncedCpuUponDebug(chip))) { altModeForDebugCombo.setSelectedIndex(j); } } altDebugPanel.add(new JLabel(Constants.CHIP_LABEL[1 - chip] + " mode when " + Constants.CHIP_LABEL[chip] + " runs in sync Debug: ")); altDebugPanel.add(altModeForDebugCombo); emulationOptionsPanel.add(altDebugPanel); emulationOptionsPanel .add(new JLabel("If 'sync mode' is selected, this is the mode the " + Constants.CHIP_LABEL[1 - chip] + " chip will run in when running the " + Constants.CHIP_LABEL[chip] + " in Debug mode")); // Alt mode upon Step JPanel altStepPanel = new JPanel(new FlowLayout()); Object[] altStepMode = EnumSet.allOf(EmulationFramework.ExecutionMode.class).toArray(); final JComboBox altModeForStepCombo = new JComboBox(new DefaultComboBoxModel(altStepMode)); for (int j = 0; j < altStepMode.length; j++) { if (altStepMode[j].equals(prefs.getAltExecutionModeForSyncedCpuUponStep(chip))) { altModeForStepCombo.setSelectedIndex(j); } } altStepPanel.add(new JLabel(Constants.CHIP_LABEL[1 - chip] + " mode when " + Constants.CHIP_LABEL[chip] + " runs in sync Step: ")); altStepPanel.add(altModeForStepCombo); emulationOptionsPanel.add(altStepPanel); emulationOptionsPanel .add(new JLabel("If 'sync mode' is selected, this is the mode the " + Constants.CHIP_LABEL[1 - chip] + " chip will run in when running the " + Constants.CHIP_LABEL[chip] + " in Step mode")); // ------------------------ Prepare tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(Constants.CHIP_LABEL[chip] + " Disassembly Options", null, disassemblyOptionsPanel); tabbedPane.addTab(Constants.CHIP_LABEL[chip] + " Emulation Options", null, emulationOptionsPanel); if (chip == Constants.CHIP_TX) { JPanel chipSpecificOptionsPanel = new JPanel(new VerticalLayout(5, VerticalLayout.LEFT)); chipSpecificOptionsPanel.add(new JLabel("Eeprom status upon startup:")); ActionListener eepromInitializationRadioActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { prefs.setEepromInitMode(Prefs.EepromInitMode.valueOf(e.getActionCommand())); } }; JRadioButton blank = new JRadioButton("Blank"); blank.setActionCommand(Prefs.EepromInitMode.BLANK.name()); blank.addActionListener(eepromInitializationRadioActionListener); if (Prefs.EepromInitMode.BLANK.equals(prefs.getEepromInitMode())) blank.setSelected(true); JRadioButton persistent = new JRadioButton("Persistent across sessions"); persistent.setActionCommand(Prefs.EepromInitMode.PERSISTENT.name()); persistent.addActionListener(eepromInitializationRadioActionListener); if (Prefs.EepromInitMode.PERSISTENT.equals(prefs.getEepromInitMode())) persistent.setSelected(true); JRadioButton lastLoaded = new JRadioButton("Last Loaded"); lastLoaded.setActionCommand(Prefs.EepromInitMode.LAST_LOADED.name()); lastLoaded.addActionListener(eepromInitializationRadioActionListener); if (Prefs.EepromInitMode.LAST_LOADED.equals(prefs.getEepromInitMode())) lastLoaded.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(blank); group.add(persistent); group.add(lastLoaded); chipSpecificOptionsPanel.add(blank); chipSpecificOptionsPanel.add(persistent); chipSpecificOptionsPanel.add(lastLoaded); chipSpecificOptionsPanel.add(new JLabel("Front panel type:")); final JComboBox frontPanelNameCombo = new JComboBox(new String[] { "D5100_small", "D5100_large" }); if (prefs.getFrontPanelName() != null) { frontPanelNameCombo.setSelectedItem(prefs.getFrontPanelName()); } frontPanelNameCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { prefs.setFrontPanelName((String) frontPanelNameCombo.getSelectedItem()); } }); chipSpecificOptionsPanel.add(frontPanelNameCombo); emulationOptionsPanel.add(new JSeparator(JSeparator.HORIZONTAL)); tabbedPane.addTab(Constants.CHIP_LABEL[chip] + " specific options", null, chipSpecificOptionsPanel); } // ------------------------ Show it if (JOptionPane.OK_OPTION == JOptionPane.showOptionDialog(this, tabbedPane, Constants.CHIP_LABEL[chip] + " options", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, JOptionPane.DEFAULT_OPTION)) { // save output options dumpOptionCheckboxes(outputOptionsCheckBoxes, prefs.getOutputOptions(chip)); // apply TxCPUState.initRegisterLabels(prefs.getOutputOptions(chip)); // save other prefs prefs.setFirmwareWriteProtected(chip, writeProtectFirmwareCheckBox.isSelected()); prefs.setDmaSynchronous(chip, dmaSynchronousCheckBox.isSelected()); prefs.setAutoEnableTimers(chip, autoEnableTimersCheckBox.isSelected()); prefs.setLogRegisterMessages(chip, logRegisterMessagesCheckBox.isSelected()); prefs.setLogSerialMessages(chip, logSerialMessagesCheckBox.isSelected()); prefs.setLogPinMessages(chip, logPinMessagesCheckBox.isSelected()); prefs.setLogMemoryMessages(chip, logMemoryMessagesCheckBox.isSelected()); prefs.setAltExecutionModeForSyncedCpuUponDebug(chip, (EmulationFramework.ExecutionMode) altModeForDebugCombo.getSelectedItem()); prefs.setAltExecutionModeForSyncedCpuUponStep(chip, (EmulationFramework.ExecutionMode) altModeForStepCombo.getSelectedItem()); } }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JTabbedPane getJTabbedPane4() { if (jTabbedPane4 == null) { jTabbedPane4 = new JTabbedPane(); jTabbedPane4.setPreferredSize(new java.awt.Dimension(660, 184)); jTabbedPane4.addTab("Information", null, getJPanel4(), null); jTabbedPane4.addTab("Register", null, getJPanel6(), null); jTabbedPane4.addTab("TSS", null, getJPanel7(), null); jTabbedPane4.addTab("GDT", null, getJPanel8(), null); jTabbedPane4.addTab("IDT", null, getJPanel9(), null); jTabbedPane4.addTab("LDT", null, getJPanel10(), null); }//from www.jav a 2s . c o m return jTabbedPane4; }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JTabbedPane getJInterruptTabbedPane() { if (jInterruptTabbedPane == null) { jInterruptTabbedPane = new JTabbedPane(); jInterruptTabbedPane.addTab("Chart", null, getJPanel12(), null); }/*from w ww . ja v a 2 s . c o m*/ return jInterruptTabbedPane; }