public void syncPanel() { panelPat.syncPanel(); regionAButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.A); regionBButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.B); regionCButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.C); elevBox.setText(dlg.panelMain.mark.getElevation()); heightBox.setText(dlg.panelMain.mark.getObjectHeight()); sourceBox.setText(dlg.panelMain.mark.getSource()); infoBox.setText(dlg.panelMain.mark.getInfo()); for (Sts sts : statuses.keySet()) { int item = statuses.get(sts); if (dlg.panelMain.mark.getStatus() == sts) statusBox.setSelectedIndex(item); } for (Cns cns : constructions.keySet()) { int item = constructions.get(cns); if (dlg.panelMain.mark.getConstr() == cns) constrBox.setSelectedIndex(item); } for (Con con : conspicuities.keySet()) { int item = conspicuities.get(con); if (dlg.panelMain.mark.getConsp() == con) conBox.setSelectedIndex(item); } for (Con con : reflectivities.keySet()) { int item = reflectivities.get(con); if (dlg.panelMain.mark.getRefl() == con) reflBox.setSelectedIndex(item); } }
public boolean isAnimated() { return animated && (radioButton == null || radioButton.getParent() == null || !(radioButton.getParent() instanceof WebListElement || radioButton.getParent() instanceof WebTreeElement)); }
/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user pressed the ok button if (e.getSource() == ok_button) { filter_include_list = include_panel.getServiceList(); filter_exclude_list = exclude_panel.getServiceList(); if (status_box.isSelected()) { filter_active = status_active.isSelected(); filter_complete = status_complete.isSelected(); } else { filter_active = false; filter_complete = false; } ok_pressed = true; dialog.dispose(); } // Check if the user pressed the cancel button if (e.getSource() == cancel_button) { dialog.dispose(); } // Check if the user changed the status filter option if (e.getSource() == status_box) { status_active.setEnabled(status_box.isSelected()); status_complete.setEnabled(status_box.isSelected()); } }
/** Loads the default settings from Preferences to set up the dialog. */ public void legacyLoadDefaults() { String defaultsString = Preferences.getDialogDefaults(getDialogName()); if ((defaultsString != null) && (newImage != null)) { try { StringTokenizer st = new StringTokenizer(defaultsString, ","); textSearchWindowSide.setText("" + MipavUtil.getInt(st)); textSimilarityWindowSide.setText("" + MipavUtil.getInt(st)); textNoiseStandardDeviation.setText("" + MipavUtil.getFloat(st)); textDegree.setText("" + MipavUtil.getFloat(st)); doRician = MipavUtil.getBoolean(st); doRicianCheckBox.setSelected(doRician); textDegree.setEnabled(doRician); labelDegree.setEnabled(doRician); image25DCheckBox.setSelected(MipavUtil.getBoolean(st)); if (MipavUtil.getBoolean(st)) { newImage.setSelected(true); } else { replaceImage.setSelected(true); } } catch (Exception ex) { // since there was a problem parsing the defaults string, start over with the original // defaults Preferences.debug("Resetting defaults for dialog: " + getDialogName()); Preferences.removeProperty(getDialogName()); } } }
void jbInit() throws Exception { setLayout(new AlignLayout(2, 5, 5)); all = new JRadioButton("All"); all.setSelected(true); select = new JRadioButton("User Data"); select.setSelected(false); select.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { select_itemStateChanged(e); } }); userData = new JTextField(15); // userData.setEnabled(false); ToggleDocument td = new ToggleDocument(); td.addToggleDocumentListener(this); userData.setDocument(td); ButtonGroup bg = new ButtonGroup(); bg.add(all); bg.add(select); add(all); add(new JLabel("")); add(select); add(userData); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); }
@Override public void actionPerformed(ActionEvent arg0) { // Pre-creation sanity if (gridPanel != null) { // Variable declaration String name, phone; // Make sure the fields have values if ((name = nameField.getText()) == "") { // Tell the user if not JOptionPane.showMessageDialog(null, "Please enter the client's name"); return; } if ((phone = phoneField.getText()) == "") { JOptionPane.showMessageDialog(null, "Please enter the client's phone number"); return; } if (hiddenRadio.isSelected()) { JOptionPane.showMessageDialog(null, "Please select the client's smoking preference"); return; } // Calculate the party size int partySize = partyBox.getSelectedIndex() + 8; // Place the reservation bookRoom(name, phone, smokingRadio.isSelected(), partySize); } else { System.out.println("Grid panel is null"); } }
private JRadioButton makeSearchInRadioButton(String label) { JRadioButton button = new JRadioButton(label, false); button.setActionCommand(label); searchIn.add(button); return button; }
public void actionPerformed(java.awt.event.ActionEvent e) { if ((dlg.panelMain.mark.getObject() != Obj.MORFAC) || (dlg.panelMain.mark.getCategory() == Cat.MOR_BUOY)) { for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (button.isSelected()) { dlg.panelMain.mark.setShape(shp); if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) != Ent.MOORING) { dlg.panelMain.mark.setObject(objects.get(shp)); if (dlg.panelMain.mark.getObjColour(0) == Col.UNKCOL) { dlg.panelMain.mark.setObjPattern(Pat.NOPAT); dlg.panelMain.mark.setObjColour(Col.YELLOW); } if (button == cairnButton) { dlg.panelMain.mark.setObjPattern(Pat.NOPAT); dlg.panelMain.mark.setObjColour(Col.UNKCOL); } topmarkButton.setVisible(dlg.panelMain.mark.testValid()); } button.setBorderPainted(true); } else button.setBorderPainted(false); } dlg.panelMain.panelMore.syncPanel(); } }
/** TabbedPaneDemo Constructor */ public TabbedPaneDemo(SwingSet2 swingset) { // Set the title for this demo, and an icon used to represent this // demo inside the SwingSet2 app. super(swingset, "TabbedPaneDemo", "toolbar/JTabbedPane.gif"); // create tab position controls JPanel tabControls = new JPanel(); tabControls.add(new JLabel(getString("TabbedPaneDemo.label"))); top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top"))); left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left"))); bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom"))); right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right"))); getDemoPanel().add(tabControls, BorderLayout.NORTH); group = new ButtonGroup(); group.add(top); group.add(bottom); group.add(left); group.add(right); top.setSelected(true); top.addActionListener(this); bottom.addActionListener(this); left.addActionListener(this); right.addActionListener(this); // create tab tabbedpane = new JTabbedPane(); getDemoPanel().add(tabbedpane, BorderLayout.CENTER); String name = getString("TabbedPaneDemo.laine"); JLabel pix = new JLabel(createImageIcon("tabbedpane/laine.jpg", name)); tabbedpane.add(name, pix); name = getString("TabbedPaneDemo.ewan"); pix = new JLabel(createImageIcon("tabbedpane/ewan.jpg", name)); tabbedpane.add(name, pix); name = getString("TabbedPaneDemo.hania"); pix = new JLabel(createImageIcon("tabbedpane/hania.jpg", name)); tabbedpane.add(name, pix); name = getString("TabbedPaneDemo.bounce"); spin = new HeadSpin(); tabbedpane.add(name, spin); tabbedpane .getModel() .addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { SingleSelectionModel model = (SingleSelectionModel) e.getSource(); if (model.getSelectedIndex() == tabbedpane.getTabCount() - 1) { spin.go(); } } }); }
// Display question and answer choices public void readQuestionAnswer(int questionID) { lblmess.setText(" " + quizPossibleAnswers[questionID][0]); choice1.setText(quizPossibleAnswers[questionID][1]); choice2.setText(quizPossibleAnswers[questionID][2]); choice3.setText(quizPossibleAnswers[questionID][3]); choice4.setText(quizPossibleAnswers[questionID][4]); choice1.setSelected(true); }
public void syncPanel() { for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (SmedAction.panelMain.mark.getShape() == shp) { button.setBorderPainted(true); } else button.setBorderPainted(false); } }
private void updateEnabledState() { myLabelEditor.setEnabled(myRbExpressionLabel.isSelected()); final boolean isChildrenExpression = myRbExpressionChildrenRenderer.isSelected(); myChildrenExpandedEditor.setEnabled(isChildrenExpression); myExpandedLabel.setEnabled(isChildrenExpression); myChildrenEditor.setEnabled(isChildrenExpression); myChildrenListEditor.setEnabled(myRbListChildrenRenderer.isSelected()); }
private JRadioButton getRegionButton( JRadioButton button, int x, int y, int w, int h, String tip) { button.setBounds(new Rectangle(x, y, w, h)); button.setBorder(BorderFactory.createLoweredBevelBorder()); button.setToolTipText(Messages.getString(tip)); button.addActionListener(alRegion); regionButtons.add(button); return button; }
public void actionPerformed(java.awt.event.ActionEvent e) { for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (button.isSelected()) { SmedAction.panelMain.mark.setShape(shp); SmedAction.panelMain.mark.setObject(objects.get(shp)); button.setBorderPainted(true); } else button.setBorderPainted(false); } if (SmedAction.panelMain.mark.testValid()) { SmedAction.panelMain.panelChan.topmarkButton.setVisible(true); SmedAction.panelMain.panelChan.lightButton.setVisible(true); if (SmedAction.panelMain.mark.getCategory() == Cat.LAM_STBD) { switch (SmedAction.panelMain.mark.getRegion()) { case A: SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT); SmedAction.panelMain.mark.setObjColour(Col.GREEN); break; case B: SmedAction.panelMain.mark.setObjPattern(Pat.NOPAT); SmedAction.panelMain.mark.setObjColour(Col.RED); break; case C: SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP); SmedAction.panelMain.mark.setObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.WHITE); SmedAction.panelMain.mark.addObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.WHITE); break; } } else { SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP); switch (SmedAction.panelMain.mark.getRegion()) { case A: SmedAction.panelMain.mark.setObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); break; case B: SmedAction.panelMain.mark.setObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.RED); break; case C: SmedAction.panelMain.mark.setObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); SmedAction.panelMain.mark.addObjColour(Col.RED); SmedAction.panelMain.mark.addObjColour(Col.GREEN); break; } } SmedAction.panelMain.panelMore.syncPanel(); } else { SmedAction.panelMain.panelChan.topmarkButton.setVisible(false); SmedAction.panelMain.panelChan.lightButton.setVisible(false); } }
@Override public void uninstallUI(final JComponent c) { radioButton.removeMouseListener(mouseAdapter); radioButton.removeItemListener(itemListener); radioButton.setIcon(null); radioButton = null; super.uninstallUI(c); }
public void showForCreation() { hiddenObstacle.setSelected(false); hiddenObstacle.setEnabled(false); for (JRadioButton tof : typeOfFood) { tof.setEnabled(true); } newCreatureButton.setEnabled(true); newJewelButton.setEnabled(true); group.setSelected(model, true); }
private JRadioButton getShapeButton( JRadioButton button, int x, int y, int w, int h, String tip, Shp shp, Obj obj) { button.setBounds(new Rectangle(x, y, w, h)); button.setBorder(BorderFactory.createLoweredBevelBorder()); button.setToolTipText(Messages.getString(tip)); button.addActionListener(alShape); shapeButtons.add(button); shapes.put(shp, button); objects.put(shp, obj); return button; }
// Get what the user selects as the answer public String getSelection() { String selectedChoice = null; Enumeration<AbstractButton> buttons = bg.getElements(); while (buttons.hasMoreElements()) { JRadioButton temp = (JRadioButton) buttons.nextElement(); if (temp.isSelected()) { selectedChoice = temp.getText(); } } return (selectedChoice); }
/** * Adds a radio button to select an algorithm. * * @param c the container into which to place the button * @param name the algorithm name * @param g the button group */ public void addRadioButton(Container c, final String name, ButtonGroup g) { ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { setAlgorithm(name); } }; JRadioButton b = new JRadioButton(name, g.getButtonCount() == 0); c.add(b); g.add(b); b.addActionListener(listener); }
public void checkUeberSchreib() { if (ueSchr.isSelected()) { cUeSchr = true; cAUeSchr = false; } else if (aUeSchr.isSelected()) { cUeSchr = false; cAUeSchr = true; } else if (nUebSchr.isSelected()) { cUeSchr = false; cAUeSchr = false; } }
public SudokuGUI(String x) { setTitle(x); textfield1.setEditable(false); button5.setEnabled(false); button10.setEnabled(false); button13.setEnabled(false); button12.setEnabled(false); button15.setEnabled(false); button18.setEnabled(false); setLayout(new GridLayout(6, 4, 4, 4)); setLocation(350, 300); button1.addMouseListener(this); button2.addMouseListener(this); button3.addMouseListener(this); button4.addMouseListener(this); button6.addMouseListener(this); button7.addMouseListener(this); button8.addMouseListener(this); button9.addMouseListener(this); button11.addMouseListener(this); button14.addMouseListener(this); button16.addMouseListener(this); button17.addMouseListener(this); button19.addMouseListener(this); button20.addMouseListener(this); textfield2.addMouseListener(this); add(button1); add(button2); add(button3); add(button4); add(button5); add(button6); add(button7); add(button8); add(button9); add(button10); add(button11); add(button12); add(button13); add(button14); add(button15); add(button16); add(button17); add(button18); add(button19); add(button20); add(textfield1); add(textfield2); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(700, 400); }
/** Sets the default values. */ protected void setDefaultValues() { if (default_values.get("star-detection-mode") != null) { int mode = ((Integer) default_values.get("star-detection-mode")).intValue(); radio_peak.setSelected(mode == DefaultStarDetector.MODE_PEAK); radio_aperture.setSelected(mode == DefaultStarDetector.MODE_APERTURE); radio_amount.setSelected( mode != DefaultStarDetector.MODE_PEAK && mode != DefaultStarDetector.MODE_APERTURE); } if (default_values.get("correct-blooming") != null) setCorrectBloomingPosition(((Boolean) default_values.get("correct-blooming")).booleanValue()); }
public void setValues() { personalFile.setText(Globals.prefs.get(JabRefPreferences.PERSONAL_JOURNAL_LIST)); if (personalFile.getText().isEmpty()) { newFile.setSelected(true); oldFile.setEnabled(false); } else { oldFile.setSelected(true); oldFile.setEnabled(true); } setupUserTable(); setupExternals(); buildExternalsPanel(); }
public int getChoice() { if (radioButtonXmp.isSelected()) { return ImportDialog.XMP; } else if (radioButtonPDFcontent.isSelected()) { return ImportDialog.CONTENT; } else if (radioButtonNoMeta.isSelected()) { return ImportDialog.NOMETA; } else if (radioButtononlyAttachPDF.isSelected()) { return ImportDialog.ONLYATTACH; } else { throw new IllegalStateException(); } }
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == bRes) { tname.setText(""); textra.setText(""); } else { if (it.isSelected()) field = 1; else if (civil.isSelected()) field = 2; else if (mech.isSelected()) field = 3; if (tname.getText().equals("") | textra.getText().equals("") | field == 0) JOptionPane.showMessageDialog(null, "Please Fill in All Entries!!"); else { String sal = (String) cbsal.getSelectedItem(); try { // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Connection conn=DriverManager.getConnection("jdbc:odbc:go"); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql:///go", "root", ""); Statement pst = conn.createStatement(); pst.executeUpdate( "Insert into company values('" + tname.getText() + "','" + textra.getText() + "','" + (String) sal + "','" + field + "','" + tusr.getText() + "','" + tpwd.getText() + "')"); conn.close(); String msg = "Your Details are Stored. Login again to View Related applicants! Thank You!!"; JOptionPane.showMessageDialog(null, msg); setVisible(false); login ab = new login(); } catch (Exception exc) { JOptionPane.showMessageDialog(null, tname.getText() + " : " + exc); System.exit(0); } } } }
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == btn) { File file; String string = ""; try { if (radioRead.isSelected()) { file = new File(txt.getText()); DataInputStream input = new DataInputStream(new FileInputStream(file)); int inByte; while ((inByte = input.read()) != -1) { string += (char) inByte; } input.close(); } else if (radioEncrypt.isSelected()) { string = fileContent.getOut(); String strEncrypt = new String(); for (int i = 0; i < string.length(); i++) { char ch = string.charAt(i); if (ch >= 'A' && ch <= 'Z') { ch += 13; if (ch > 'Z') { ch -= 26; } } else if (ch >= 'a' && ch <= 'z') { ch += 13; if (ch > 'z') { ch -= 26; } } strEncrypt += ch; } string = strEncrypt; } if (fileContent == null) { fileContent = new FileContent(string); } else { fileContent.setVisible(true); fileContent.setOut(string); } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(this, "Can't find the file."); } catch (IOException e) { JOptionPane.showMessageDialog(this, "IO Exception " + e.getMessage()); } } }
/** * @param shortcut dialog will be initialized with this <code>shortcut</code>. It can be <code> * null</code> if dialog is used to create new mouse shortcut. */ public MouseShortcutDialog( JComponent parentComponent, MouseShortcut shortcut, @NotNull Keymap keymap, @NotNull String actiondId, @NotNull Group mainGroup) { super(parentComponent, true); setTitle(KeyMapBundle.message("mouse.shortcut.dialog.title")); myKeymap = keymap; myActionId = actiondId; myMainGroup = mainGroup; myRbSingleClick = new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.single.click.radio")); myRbDoubleClick = new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.double.click.radio")); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(myRbSingleClick); buttonGroup.add(myRbDoubleClick); myLblPreview = new JLabel(" "); myClickPad = new MyClickPad(); myTarConflicts = new JTextArea(); myTarConflicts.setFocusable(false); myTarConflicts.setEditable(false); myTarConflicts.setBackground(UIUtil.getPanelBackground()); myTarConflicts.setLineWrap(true); myTarConflicts.setWrapStyleWord(true); if (shortcut != null) { if (shortcut.getClickCount() == 1) { myRbSingleClick.setSelected(true); } else { myRbDoubleClick.setSelected(true); } myButton = shortcut.getButton(); myModifiers = shortcut.getModifiers(); } else { myRbSingleClick.setSelected(true); myButton = -1; myModifiers = -1; } updatePreviewAndConflicts(); init(); }
/** * Constructs a button panel. * * @param title the title shown in the border * @param options an array of radio button labels */ public ButtonPanel(String title, String... options) { setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); group = new ButtonGroup(); // make one radio button for each option for (String option : options) { JRadioButton b = new JRadioButton(option); b.setActionCommand(option); add(b); group.add(b); b.setSelected(option == options[0]); } }
public void actionPerformed(ActionEvent ev) { ThingCreator tc = new ThingCreator(e); if (e.nonPerishableFood.equals(ev.getActionCommand())) { food = tc.createThing(Constants.categoryNPFOOD, x, y); PFoodRadio.setEnabled(false); } else { // perishable food food = tc.createThing(Constants.categoryPFOOD, x, y); NPFoodRadio.setEnabled(false); } newCreatureButton.setEnabled(false); newJewelButton.setEnabled(false); setFood(food); }
public RadioButtons() { rb1.addActionListener(al); rb2.addActionListener(al); rb3.addActionListener(al); g.add(rb1); g.add(rb2); g.add(rb3); t.setEditable(false); setLayout(new FlowLayout()); add(t); add(rb1); add(rb2); add(rb3); }