List of usage examples for javax.swing JRadioButton addActionListener
public void addActionListener(ActionListener l)
ActionListener
to the button. From source file:eu.apenet.dpt.standalone.gui.APETabbedPane.java
private JComponent makeCheckboxes() { xsltPanel.setLayout(new BoxLayout(xsltPanel, BoxLayout.PAGE_AXIS)); xsltPanel.add(stylesheetLabel);//from www . ja va 2s.com JRadioButton radioButton; for (File xsltFile : Utilities.getXsltFiles()) { radioButton = new JRadioButton(xsltFile.getName()); if (xsltFile.getName().equals(retrieveFromDb.retrieveDefaultXsl())) radioButton.setSelected(true); radioButton.addActionListener(new XsltSelectorListener(dataPreparationToolGUI)); dataPreparationToolGUI.getGroupXslt().add(radioButton); xsltPanel.add(radioButton); xsltPanel.add(Box.createRigidArea(new Dimension(0, 10))); } return xsltPanel; }
From source file:eu.apenet.dpt.standalone.gui.APETabbedPane.java
private JComponent makeCheckboxesXsd() { xsdPanel.setLayout(new BoxLayout(xsdPanel, BoxLayout.PAGE_AXIS)); xsdPanel.add(schemaLabel);/*from w ww . j ava 2s . c o m*/ JRadioButton radioButton; for (Xsd_enum xsdEnum : Xsd_enum.values()) { radioButton = new JRadioButton(xsdEnum.getReadableName()); if (xsdEnum.getReadableName().equals(retrieveFromDb.retrieveDefaultXsd())) radioButton.setSelected(true); radioButton.addActionListener(new XsdSelectorListener(dataPreparationToolGUI)); dataPreparationToolGUI.getGroupXsd().add(radioButton); xsdPanel.add(radioButton); xsdPanel.add(Box.createRigidArea(new Dimension(0, 10))); } for (XsdObject additionalXsd : retrieveFromDb.retrieveAdditionalXsds()) { radioButton = new JRadioButton(additionalXsd.getName()); radioButton.addActionListener(new XsdSelectorListener(dataPreparationToolGUI)); dataPreparationToolGUI.getGroupXsd().add(radioButton); xsdPanel.add(radioButton); xsdPanel.add(Box.createRigidArea(new Dimension(0, 10))); } return xsdPanel; }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ.java
public void initMapPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;/*w w w .ja v a 2 s. c o m*/ bPanel = new JPanel(new BorderLayout()); mapPanel = new JPanel(new GridLayout(2, 3, 50, 50)); bPanel.add(mapPanel, BorderLayout.CENTER); addButton1.addActionListener(this); addButton2.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); lModelAdded = new DefaultListModel(); lModelDep = new DefaultListModel(); lModelIndep = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModelAdded); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModelDep); listIndepRemoved = new JList(lModelIndep); paintMappingLists(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); tools1 = new JToolBar(JToolBar.VERTICAL); tools2 = new JToolBar(JToolBar.VERTICAL); tools1.add(depLabel); // tools2.add(indLabel); tools1.setFloatable(false); tools2.setFloatable(false); tools1.add(addButton1); tools1.add(removeButton1); // tools2.add(addButton2); // tools2.add(removeButton2); JRadioButton disChoices_normal; JRadioButton disChoices_poisson; // JPanel choicesPanel = new JPanel(); disChoices_normal = new JRadioButton("Normal"); disChoices_normal.addActionListener(this); disChoices_normal.setActionCommand(NORMAL); disChoices_normal.setSelected(true); disChoice = NORMAL; disChoices_poisson = new JRadioButton("Poisson"); disChoices_poisson.addActionListener(this); disChoices_poisson.setActionCommand(POISSON); ButtonGroup group = new ButtonGroup(); group.add(disChoices_normal); group.add(disChoices_poisson); choicesPanel.add(new JLabel("Choices of distribution:")); choicesPanel.add(disChoices_normal); choicesPanel.add(disChoices_poisson); choicesPanel.setPreferredSize(new Dimension(200, 100)); mapPanel.add(new JScrollPane(listAdded)); mapPanel.add(tools1); mapPanel.add(new JScrollPane(listDepRemoved)); // JPanel emptyPanel = new JPanel(new GridLayout(0,1)); // mapPanel.add(emptyPanel); mapPanel.add(choicesPanel); mapPanel.add(tools2); mapPanel.add(new JScrollPane(listIndepRemoved)); }
From source file:com.diversityarrays.kdxplore.trials.SampleGroupExportDialog.java
public SampleGroupExportDialog(Window owner, String title, Trial trial, KdxploreDatabase kdxploreDatabase, DeviceType deviceType, DeviceIdentifier devid, SampleGroup sampleGroup, Set<Integer> excludeTheseTraitIds, Map<Integer, Trait> allTraitIds, Set<Integer> excludeThesePlotIds) { super(owner, title, ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setGlassPane(backgroundRunner.getBlockingPane()); this.allTraits = allTraitIds; this.trial = trial; this.kdxploreDatabase = kdxploreDatabase; this.sampleGroup = sampleGroup; this.excludeTheseTraitIds = excludeTheseTraitIds; this.excludeThesePlotIds = excludeThesePlotIds; String deviceName = devid == null ? "Unknown_" + deviceType.name() : devid.getDeviceName(); if (DeviceType.FOR_SCORING.equals(deviceType)) { if (!Check.isEmpty(sampleGroup.getOperatorName())) { deviceName = sampleGroup.getOperatorName(); }/* ww w . j a v a 2 s . c o m*/ } File directory = KdxplorePreferences.getInstance().getOutputDirectory(); if (directory == null) { directory = new File(System.getProperty("user.home")); } String filename = Util.getTimestampedOutputFileName(trial.getTrialName(), deviceName); File outfile = new File(directory, filename); filepathText.setText(outfile.getPath()); filepathText.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateButtons(); } @Override public void insertUpdate(DocumentEvent e) { updateButtons(); } @Override public void changedUpdate(DocumentEvent e) { updateButtons(); } }); updateButtons(); boolean developer = RunMode.getRunMode().isDeveloper(); oldKdsmartOption.setForeground(Color.BLUE); oldKdsmartOption.setToolTipText("For ElapsedDays value compatiblity with older versions of KDSmart"); Box exportForOptionsBox = Box.createHorizontalBox(); for (JComponent comp : exportForOptions) { if (developer || comp != oldKdsmartOption) { exportForOptionsBox.add(comp); } } Map<JRadioButton, OutputOption> optionByRb = new HashMap<>(); ActionListener rbListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectedOutputOption = optionByRb.get(e.getSource()); boolean enb = selectedOutputOption.exportFor != null; for (JComponent comp : exportForOptions) { if (comp == wantMediaFilesOption) { comp.setEnabled(enb && selectedOutputOption.supportsMediaFiles()); } else if (comp == kdsmartVersion3option) { comp.setEnabled(enb && selectedOutputOption.usesWorkPackage()); } else { comp.setEnabled(enb); } } } }; boolean anySamplesForIndividuals = true; try { anySamplesForIndividuals = kdxploreDatabase.getAnySamplesForIndividuals(sampleGroup); } catch (IOException e) { Shared.Log.w("SampleGroupExportDialog", "getAnySamplesForIndividuals", e); } ButtonGroup bg = new ButtonGroup(); Box radioButtons = Box.createHorizontalBox(); List<OutputOption> options = new ArrayList<>(); Collections.addAll(options, OutputOption.values()); if (!anySamplesForIndividuals) { // No relevant samples so don't bother offering the option. options.remove(OutputOption.CSV_FULL); } for (OutputOption oo : options) { if (!developer && OutputOption.JSON == oo) { continue; } JRadioButton rb = new JRadioButton(oo.displayName); if (OutputOption.KDX == oo) { kdxExportButton = rb; } if (OutputOption.ZIP == oo) { zipExportButton = rb; } rb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportExclusionBox.selectAndDeactivateButtons( kdxExportButton.isSelected() || zipExportButton.isSelected()); } }); if (OutputOption.JSON == oo) { rb.setForeground(Color.BLUE); rb.setToolTipText("Developer Only"); } bg.add(rb); optionByRb.put(rb, oo); radioButtons.add(rb); rb.addActionListener(rbListener); if (bg.getButtonCount() == 1) { rb.doClick(); } } Box additionalOptionsBox = Box.createHorizontalBox(); additionalOptionsBox.add(this.wantMediaFilesOption); additionalOptionsBox.add(this.kdsmartVersion3option); dbVersionLabel.setToolTipText(TTT_DATABASE_VERSION_FOR_EXPORT); databaseVersionChoices.setToolTipText(TTT_DATABASE_VERSION_FOR_EXPORT); JPanel panel = new JPanel(); GBH gbh = new GBH(panel); int y = 0; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, "Output File:"); gbh.add(1, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, filepathText); gbh.add(2, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, new JButton(browseFileAction)); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, "Options:"); gbh.add(1, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, radioButtons); ++y; gbh.add(0, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, exportExclusionBox); ++y; gbh.add(0, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, additionalOptionsBox); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, dbVersionLabel); gbh.add(1, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, BoxBuilder.horizontal().add(databaseVersionChoices).get()); gbh.add(1, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, exportForOptionsBox); ++y; Box buttons = Box.createHorizontalBox(); buttons.add(Box.createHorizontalGlue()); buttons.add(new JButton(cancelAction)); buttons.add(new JButton(exportAction)); buttons.add(new JButton(exportAndCloseAction)); Container cp = getContentPane(); cp.add(panel, BorderLayout.CENTER); cp.add(buttons, BorderLayout.SOUTH); pack(); }
From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java
public void initMapPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;//from w ww. j a v a2 s. co m bPanel = new JPanel(new BorderLayout()); mapPanel = new JPanel(new GridLayout(2, 5, 50, 50)); bPanel.add(mapPanel, BorderLayout.CENTER); // bPanel.add(new JPanel(),BorderLayout.NORTH); addButton1.addActionListener(this); addButton2.addActionListener(this); addButton3.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); removeButton3.addActionListener(this); lModelAdded = new DefaultListModel(); lModelDep = new DefaultListModel(); lModelIndep = new DefaultListModel(); lModelPullout = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModelAdded); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModelDep); listIndepRemoved = new JList(lModelIndep); listPulloutRemoved = new JList(lModelPullout); paintTable(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); listPulloutRemoved.setFixedCellWidth(cellWidth); tools1 = new JToolBar(JToolBar.VERTICAL); tools2 = new JToolBar(JToolBar.VERTICAL); tools3 = new JToolBar(JToolBar.VERTICAL); if (mapDep) { tools1.add(depLabel); tools1.add(addButton1); tools1.add(removeButton1); } if (mapIndep) { tools2.add(indLabel); tools2.add(addButton2); tools2.add(removeButton2); } if (mapPullout) { tools3.add(pulloutLabel); tools3.add(addButton3); tools3.add(removeButton3); } tools1.setFloatable(false); tools2.setFloatable(false); tools3.setFloatable(false); /* topPanel.add(listAdded); topPanel.add(addButton); topPanel.add(listDepRemoved); bottomPanel.add(listIndepRemoved); bottomPanel.add(addButton2); bottomPanel.add(list4); */ JRadioButton legendPanelOnSwitch; JRadioButton legendPanelOffSwitch; // JPanel choicesPanel = new JPanel(); choicesPanel.setLayout(new BoxLayout(choicesPanel, BoxLayout.Y_AXIS)); legendPanelOnSwitch = new JRadioButton("On"); legendPanelOnSwitch.addActionListener(this); legendPanelOnSwitch.setActionCommand(LEGENDON); legendPanelOnSwitch.setSelected(false); legendPanelOn = false; legendPanelOffSwitch = new JRadioButton("Off"); legendPanelOffSwitch.addActionListener(this); legendPanelOffSwitch.setActionCommand(LEGENDOFF); legendPanelOffSwitch.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(legendPanelOnSwitch); group.add(legendPanelOffSwitch); choicesPanel.add(new JLabel("Turn the legend panel:")); choicesPanel.add(legendPanelOnSwitch); choicesPanel.add(legendPanelOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JRadioButton rotateOnSwitch; JRadioButton rotateOffSwitch; // JPanel rotateChoicesPanel = new JPanel(); rotateChoicesPanel.setLayout(new BoxLayout(rotateChoicesPanel, BoxLayout.Y_AXIS)); rotateOnSwitch = new JRadioButton("On"); rotateOnSwitch.addActionListener(this); rotateOnSwitch.setActionCommand(ROTATEON); rotateOnSwitch.setSelected(false); rotateOn = false; rotateOffSwitch = new JRadioButton("Off"); rotateOffSwitch.addActionListener(this); rotateOffSwitch.setActionCommand(ROTATEOFF); rotateOffSwitch.setSelected(true); ButtonGroup group2 = new ButtonGroup(); group2.add(rotateOnSwitch); group2.add(rotateOffSwitch); choicesPanel.add(new JLabel("Turn the rotator:")); choicesPanel.add(rotateOnSwitch); choicesPanel.add(rotateOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JPanel emptyPanel = new JPanel(); JPanel emptyPanel2 = new JPanel(); JPanel emptyPanel3 = new JPanel(); //2X5 //first line mapPanel.add(new JScrollPane(listAdded)); mapPanel.add(tools1); mapPanel.add(new JScrollPane(listDepRemoved)); mapPanel.add(tools3); if (mapPullout) mapPanel.add(new JScrollPane(listPulloutRemoved)); else mapPanel.add(emptyPanel); //second line-- mapPanel.add(choicesPanel); mapPanel.add(tools2); mapPanel.add(new JScrollPane(listIndepRemoved)); mapPanel.add(emptyPanel2); mapPanel.add(emptyPanel3); }
From source file:LightBug.java
JPanel lightPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(0, 1)); panel.add(new JLabel("Light type")); // create the buttons JRadioButton lightNoneButton = new JRadioButton(lightNoneString); JRadioButton lightDirectionalButton = new JRadioButton(lightDirectionalString); JRadioButton lightPointButton = new JRadioButton(lightPointString); JRadioButton lightSpotButton = new JRadioButton(lightSpotString); // set up the action commands lightNoneButton.setActionCommand(lightNoneString); lightDirectionalButton.setActionCommand(lightDirectionalString); lightPointButton.setActionCommand(lightPointString); lightSpotButton.setActionCommand(lightSpotString); // add the buttons to a group so that only one can be selected ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(lightNoneButton);/*from w w w. j a va 2 s.com*/ buttonGroup.add(lightDirectionalButton); buttonGroup.add(lightPointButton); buttonGroup.add(lightSpotButton); // register the applet as the listener for the buttons lightNoneButton.addActionListener(this); lightDirectionalButton.addActionListener(this); lightPointButton.addActionListener(this); lightSpotButton.addActionListener(this); // add the buttons to the panel panel.add(lightNoneButton); panel.add(lightDirectionalButton); panel.add(lightPointButton); panel.add(lightSpotButton); // set the default lightDirectionalButton.setSelected(true); return panel; }
From source file:RadioButtonDemo.java
public RadioButtonDemo() { super(new BorderLayout()); //Create the radio buttons. JRadioButton birdButton = new JRadioButton(birdString); birdButton.setMnemonic(KeyEvent.VK_B); birdButton.setActionCommand(birdString); birdButton.setSelected(true);//from w ww. java2 s . co m JRadioButton catButton = new JRadioButton(catString); catButton.setMnemonic(KeyEvent.VK_C); catButton.setActionCommand(catString); JRadioButton dogButton = new JRadioButton(dogString); dogButton.setMnemonic(KeyEvent.VK_D); dogButton.setActionCommand(dogString); JRadioButton rabbitButton = new JRadioButton(rabbitString); rabbitButton.setMnemonic(KeyEvent.VK_R); rabbitButton.setActionCommand(rabbitString); JRadioButton pigButton = new JRadioButton(pigString); pigButton.setMnemonic(KeyEvent.VK_P); pigButton.setActionCommand(pigString); //Group the radio buttons. ButtonGroup group = new ButtonGroup(); group.add(birdButton); group.add(catButton); group.add(dogButton); group.add(rabbitButton); group.add(pigButton); //Register a listener for the radio buttons. birdButton.addActionListener(this); catButton.addActionListener(this); dogButton.addActionListener(this); rabbitButton.addActionListener(this); pigButton.addActionListener(this); //Set up the picture label. picture = new JLabel(createImageIcon("images/" + birdString + ".gif")); //The preferred size is hard-coded to be the width of the //widest image and the height of the tallest image. //A real program would compute this. picture.setPreferredSize(new Dimension(177, 122)); //Put the radio buttons in a column in a panel. JPanel radioPanel = new JPanel(new GridLayout(0, 1)); radioPanel.add(birdButton); radioPanel.add(catButton); radioPanel.add(dogButton); radioPanel.add(rabbitButton); radioPanel.add(pigButton); add(radioPanel, BorderLayout.LINE_START); add(picture, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:PVGraph.java
private JPanel makeCommonButtonsPanel(final PVGraphView view) { JPanel commonButtonsPanel = new JPanel(); commonButtonsPanel.setBorder(new EtchedBorder()); JButton newGraphButton = new JButton("New Graph"); newGraphButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { new PVGraph((Calendar) PVGraph.this.date.clone(), tabPane.getSelectedIndex()); }/*from w w w.j av a2s . c o m*/ }); JButton runSmatoolButton = new JButton("Run smatool"); runSmatoolButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { runSmatool(); view.updateChart(); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } } }); commonButtonsPanel.add(newGraphButton); if (Integer.decode(props.getProperty("smatool.havebutton", "1")) != 0) commonButtonsPanel.add(runSmatoolButton); int smatoolPeriod = Integer.decode(props.getProperty("smatool.period", "0")); if (smatoolPeriod > 0) { final JRadioButton trackDayRadioButton = new JRadioButton("Track day"); trackDayRadioButton.setSelected(trackDay); trackDayRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { trackDay = trackDayRadioButton.isSelected(); } }); commonButtonsPanel.add(trackDayRadioButton); } return commonButtonsPanel; }
From source file:it.iit.genomics.cru.igb.bundles.mi.view.MIResultPanel.java
public MIResultPanel(IgbService service, String summary, List<MIResult> results, String label, MIQuery query) { setLayout(new BorderLayout()); this.label = label; igbLogger = IGBLogger.getInstance(label); colorer = TaxonColorer.getColorer(query.getTaxid()); Box menuBox = new Box(BoxLayout.X_AXIS); Box buttonBox = new Box(BoxLayout.Y_AXIS); Box buttonBox1 = new Box(BoxLayout.X_AXIS); Box buttonBox3 = new Box(BoxLayout.X_AXIS); buttonBox.add(buttonBox1);/*from w w w.j a va2s . c om*/ buttonBox.add(buttonBox3); JTextPane querySummary = new JTextPane(); querySummary.setContentType("text/html"); querySummary.setEditable(false); querySummary.setText(summary); menuBox.add(querySummary); menuBox.add(buttonBox); final JFrame logFrame = new JFrame("MI Bundle Log"); logFrame.setVisible(false); Dimension preferredSize = new Dimension(800, 500); logFrame.setPreferredSize(preferredSize); logFrame.setMinimumSize(preferredSize); logFrame.add(new LogPanel(igbLogger)); JButton log = new JButton(); if (igbLogger.hasError()) { log.setBackground(Color.red); } log.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/console.png")); log.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logFrame.setVisible(true); } }); buttonBox1.add(log); JButton networkButton = new JButton(""); networkButton.setIcon(new ImageIcon(getClass().getResource("/network.jpg"))); networkButton.addActionListener(new DisplayNetworkActionListener()); buttonBox1.add(networkButton); buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("Save: ")); JButton exportButton = new JButton("text"); exportButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png")); exportButton.addActionListener(new ExportActionListener()); if (false == MICommons.testVersion) { buttonBox1.add(exportButton); } JButton exportXgmmlButton = new JButton("xgmml"); exportXgmmlButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png")); exportXgmmlButton.addActionListener(new ExportXgmmlActionListener()); if (false == MICommons.testVersion) { buttonBox1.add(exportXgmmlButton); } buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("View structure: ")); structures = new StructuresPanel(service, label); buttonBox1.add(structures.getJmolButton()); buttonBox1.add(structures.getLinkButton()); // Filters ButtonGroup scoreGroup = new ButtonGroup(); JRadioButton scoreButton0 = new JRadioButton("<html>" + HTML_SCORE_0 + "</html>"); JRadioButton scoreButton1 = new JRadioButton("<html>" + HTML_SCORE_1 + "</html>"); JRadioButton scoreButton2 = new JRadioButton("<html>" + HTML_SCORE_2 + "</html>"); JRadioButton scoreButton3 = new JRadioButton("<html>" + HTML_SCORE_3 + "</html>"); scoreButton0.setSelected(true); ScoreListener scoreListener = new ScoreListener(); scoreButton0.addActionListener(scoreListener); scoreButton1.addActionListener(scoreListener); scoreButton2.addActionListener(scoreListener); scoreButton3.addActionListener(scoreListener); scoreGroup.add(scoreButton0); scoreGroup.add(scoreButton1); scoreGroup.add(scoreButton2); scoreGroup.add(scoreButton3); buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("Score: ")); buttonBox1.add(scoreButton0); buttonBox1.add(scoreButton1); buttonBox1.add(scoreButton2); buttonBox1.add(scoreButton3); buttonBox3.add(new JLabel("Interaction type: ")); JCheckBox EvidencePhysicalButton = new JCheckBox(HTML_CHECKBOX_PHYSICAL); JCheckBox EvidenceAssociationButton = new JCheckBox(HTML_CHECKBOX_ASSOCIATION); JCheckBox EvidenceEnzymaticButton = new JCheckBox(HTML_CHECKBOX_ENZYMATIC); JCheckBox EvidenceOtherButton = new JCheckBox(HTML_CHECKBOX_OTHER); JCheckBox EvidenceUnspecifiedButton = new JCheckBox(HTML_CHECKBOX_UNSPECIFIED); JCheckBox EvidenceStructureButton = new JCheckBox(HTML_CHECKBOX_STRUCTURE); EvidencePhysicalButton.setSelected(true); EvidenceAssociationButton.setSelected(true); EvidenceEnzymaticButton.setSelected(true); EvidenceOtherButton.setSelected(true); EvidenceUnspecifiedButton.setSelected(true); EvidenceStructureButton.setSelected(true); buttonBox3.add(EvidencePhysicalButton); buttonBox3.add(EvidenceAssociationButton); buttonBox3.add(EvidenceEnzymaticButton); buttonBox3.add(EvidenceOtherButton); buttonBox3.add(EvidenceUnspecifiedButton); buttonBox3.add(EvidenceStructureButton); EvidenceTypeListener evidenceListener = new EvidenceTypeListener(); EvidencePhysicalButton.addActionListener(evidenceListener); EvidenceAssociationButton.addActionListener(evidenceListener); EvidenceEnzymaticButton.addActionListener(evidenceListener); EvidenceOtherButton.addActionListener(evidenceListener); EvidenceUnspecifiedButton.addActionListener(evidenceListener); EvidenceStructureButton.addActionListener(evidenceListener); Box tableBox = new Box(BoxLayout.Y_AXIS); MITableModel model = new MITableModel(results); miTable = new MITable(model, service, query); miTable.setFillsViewportHeight(true); miTable.setStructuresPanel(structures); tableBox.add(miTable.getTableHeader()); tableBox.add(miTable); JScrollPane tableScroll = new JScrollPane(tableBox); tableScroll.setMinimumSize(new Dimension(800, 50)); tableScroll.setPreferredSize(new Dimension(800, 50)); tableScroll.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); structures.setMinimumSize(new Dimension(200, 500)); structures.setPreferredSize(new Dimension(200, 500)); structures.setMaximumSize(new Dimension(200, Short.MAX_VALUE)); resultBox = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tableScroll, structures); resultBox.setOneTouchExpandable(true); add(menuBox, BorderLayout.NORTH); add(resultBox, BorderLayout.CENTER); }
From source file:TexBug.java
JPanel texture2DPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(1, 0)); // horizontal JPanel leftPanel = new JPanel(); leftPanel.setLayout(new GridLayout(0, 1)); // vertical panel.add(leftPanel);/*from w w w . ja v a 2 s .co m*/ JPanel rightPanel = new JPanel(); rightPanel.setLayout(new GridLayout(0, 1)); // vertical panel.add(rightPanel); texEnableCheckBox = new JCheckBox(texEnableString); // set up the action commands texEnableCheckBox.setActionCommand(texEnableString); // register the applet as the listener for the buttons texEnableCheckBox.addActionListener(this); // set the initial value texEnableCheckBox.setSelected(texEnable); // add the checkbox to the panel leftPanel.add(texEnableCheckBox); // texture boundary S leftPanel.add(new JLabel("Boundary S Mode:")); // create the buttons JRadioButton texBoundarySWrapButton = new JRadioButton(wrapString); JRadioButton texBoundarySClampButton = new JRadioButton(clampString); // set up the action commands texBoundarySWrapButton.setActionCommand(texBoundarySWrapString); texBoundarySClampButton.setActionCommand(texBoundarySClampString); // add the buttons to a group so that only one can be selected ButtonGroup boundSButtonGroup = new ButtonGroup(); boundSButtonGroup.add(texBoundarySWrapButton); boundSButtonGroup.add(texBoundarySClampButton); // register the applet as the listener for the buttons texBoundarySWrapButton.addActionListener(this); texBoundarySClampButton.addActionListener(this); // add the buttons to the panel leftPanel.add(texBoundarySWrapButton); leftPanel.add(texBoundarySClampButton); // set the default texBoundarySWrapButton.setSelected(true); // texture boundary T leftPanel.add(new JLabel("Boundary T Mode:")); // create the buttons JRadioButton texBoundaryTWrapButton = new JRadioButton(wrapString); JRadioButton texBoundaryTClampButton = new JRadioButton(clampString); // set up the action commands texBoundaryTWrapButton.setActionCommand(texBoundaryTWrapString); texBoundaryTClampButton.setActionCommand(texBoundaryTClampString); // add the buttons to a group so that only one can be selected ButtonGroup boundTButtonGroup = new ButtonGroup(); boundTButtonGroup.add(texBoundaryTWrapButton); boundTButtonGroup.add(texBoundaryTClampButton); // register the applet as the listener for the buttons texBoundaryTWrapButton.addActionListener(this); texBoundaryTClampButton.addActionListener(this); // add the buttons to the panel leftPanel.add(texBoundaryTWrapButton); leftPanel.add(texBoundaryTClampButton); // set the default texBoundaryTWrapButton.setSelected(true); // texture min filter rightPanel.add(new JLabel("Min Filter:")); // create the buttons JRadioButton texMinFilterBasePointButton = new JRadioButton(texFilterBasePointString); JRadioButton texMinFilterBaseLinearButton = new JRadioButton(texFilterBaseLinearString); JRadioButton texMinFilterMultiPointButton = new JRadioButton(texFilterMultiPointString); JRadioButton texMinFilterMultiLinearButton = new JRadioButton(texFilterMultiLinearString); JRadioButton texMinFilterNicestButton = new JRadioButton(nicestString); JRadioButton texMinFilterFastestButton = new JRadioButton(fastestString); // set up the action commands texMinFilterBasePointButton.setActionCommand(texMinFilterBasePointString); texMinFilterBaseLinearButton.setActionCommand(texMinFilterBaseLinearString); texMinFilterMultiPointButton.setActionCommand(texMinFilterMultiPointString); texMinFilterMultiLinearButton.setActionCommand(texMinFilterMultiLinearString); texMinFilterNicestButton.setActionCommand(texMinFilterNicestString); texMinFilterFastestButton.setActionCommand(texMinFilterFastestString); // add the buttons to a group so that only one can be selected ButtonGroup minFilterButtonGroup = new ButtonGroup(); minFilterButtonGroup.add(texMinFilterBasePointButton); minFilterButtonGroup.add(texMinFilterBaseLinearButton); minFilterButtonGroup.add(texMinFilterMultiPointButton); minFilterButtonGroup.add(texMinFilterMultiLinearButton); minFilterButtonGroup.add(texMinFilterNicestButton); minFilterButtonGroup.add(texMinFilterFastestButton); // register the applet as the listener for the buttons texMinFilterBasePointButton.addActionListener(this); texMinFilterBaseLinearButton.addActionListener(this); texMinFilterMultiPointButton.addActionListener(this); texMinFilterMultiLinearButton.addActionListener(this); texMinFilterNicestButton.addActionListener(this); texMinFilterFastestButton.addActionListener(this); // add the buttons to the panel rightPanel.add(texMinFilterBasePointButton); rightPanel.add(texMinFilterBaseLinearButton); rightPanel.add(texMinFilterMultiPointButton); rightPanel.add(texMinFilterMultiLinearButton); rightPanel.add(texMinFilterNicestButton); rightPanel.add(texMinFilterFastestButton); // set the default texMinFilterBasePointButton.setSelected(true); // texture max filter rightPanel.add(new JLabel("Mag Filter:")); // create the buttons JRadioButton texMagFilterBasePointButton = new JRadioButton(texFilterBasePointString); JRadioButton texMagFilterBaseLinearButton = new JRadioButton(texFilterBaseLinearString); JRadioButton texMagFilterNicestButton = new JRadioButton(nicestString); JRadioButton texMagFilterFastestButton = new JRadioButton(fastestString); // set up the action commands texMagFilterBasePointButton.setActionCommand(texMagFilterBasePointString); texMagFilterBaseLinearButton.setActionCommand(texMagFilterBaseLinearString); texMagFilterNicestButton.setActionCommand(texMagFilterNicestString); texMagFilterFastestButton.setActionCommand(texMagFilterFastestString); // add the buttons to a group so that only one can be selected ButtonGroup magFilterButtonGroup = new ButtonGroup(); magFilterButtonGroup.add(texMagFilterBasePointButton); magFilterButtonGroup.add(texMagFilterBaseLinearButton); magFilterButtonGroup.add(texMagFilterNicestButton); magFilterButtonGroup.add(texMagFilterFastestButton); // register the applet as the listener for the buttons texMagFilterBasePointButton.addActionListener(this); texMagFilterBaseLinearButton.addActionListener(this); texMagFilterNicestButton.addActionListener(this); texMagFilterFastestButton.addActionListener(this); // add the buttons to the panel rightPanel.add(texMagFilterBasePointButton); rightPanel.add(texMagFilterBaseLinearButton); rightPanel.add(texMagFilterNicestButton); rightPanel.add(texMagFilterFastestButton); // set the default texMagFilterBasePointButton.setSelected(true); // MipMap Mode leftPanel.add(new JLabel("MipMap Mode:")); // create the buttons JRadioButton texMipMapBaseButton = new JRadioButton(texMipMapBaseString); JRadioButton texMipMapMultiButton = new JRadioButton(texMipMapMultiString); // set up the action commands texMipMapBaseButton.setActionCommand(texMipMapBaseString); texMipMapMultiButton.setActionCommand(texMipMapMultiString); // add the buttons to a group so that only one can be selected ButtonGroup texMipMapButtonGroup = new ButtonGroup(); texMipMapButtonGroup.add(texMipMapBaseButton); texMipMapButtonGroup.add(texMipMapMultiButton); // register the applet as the listener for the buttons texMipMapBaseButton.addActionListener(this); texMipMapMultiButton.addActionListener(this); // add the buttons to the panel leftPanel.add(texMipMapBaseButton); leftPanel.add(texMipMapMultiButton); // set the default texMipMapBaseButton.setSelected(true); return panel; }