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 void run() { try { thread.sleep(1111); } catch (Exception e) { return; } Thread me = Thread.currentThread(); while (thread == me) { for (int i = 0; i < ImageOps.imgName.length; i++) { imgCombo.setSelectedIndex(i); for (int j = 0; j < ImageOps.opsName.length; j++) { opsCombo.setSelectedIndex(j); if (j <= 1) { for (int k = 50; k <= 200; k += 10) { demo.slider1.setValue(k); try { thread.sleep(200); } catch (InterruptedException e) { return; } } } try { thread.sleep(4444); } catch (InterruptedException e) { return; } } } } thread = null; }
private void setupAttributes() { Color frameColor = (Color) AttributeFigure.getDefaultAttribute("FrameColor"); Color fillColor = (Color) AttributeFigure.getDefaultAttribute("FillColor"); Color textColor = (Color) AttributeFigure.getDefaultAttribute("TextColor"); Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute("ArrowMode"); String fontName = (String) AttributeFigure.getDefaultAttribute("FontName"); FigureEnumeration k = view().selectionElements(); while (k.hasMoreElements()) { Figure f = k.nextFigure(); frameColor = (Color) f.getAttribute("FrameColor"); fillColor = (Color) f.getAttribute("FillColor"); textColor = (Color) f.getAttribute("TextColor"); arrowMode = (Integer) f.getAttribute("ArrowMode"); fontName = (String) f.getAttribute("FontName"); } fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); // fTextColor.select(ColorMap.colorIndex(textColor)); if (arrowMode != null) { fArrowChoice.setSelectedIndex(arrowMode.intValue()); } if (fontName != null) { fFontChoice.setSelectedItem(fontName); } }
private void setupAttributes() { Color frameColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR); Color fillColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR); Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE); String fontName = (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME); FigureEnumeration fe = view().selection(); while (fe.hasNextFigure()) { Figure f = fe.nextFigure(); frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR); fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR); arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE); fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME); } fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); if (arrowMode != null) { fArrowChoice.setSelectedIndex(arrowMode.intValue()); } if (fontName != null) { fFontChoice.setSelectedItem(fontName); } }
/** Configure this panel for the Shapiro, Rambaut and Drummond 2006 codon position model */ private void setSRD06Model() { nucSubstCombo.setSelectedIndex(0); heteroCombo.setSelectedIndex(1); codingCombo.setSelectedIndex(1); substUnlinkCheck.setSelected(true); heteroUnlinkCheck.setSelected(true); freqsUnlinkCheck.setSelected(false); }
public GlobalAttributes() { setLayout(new BorderLayout()); LabelledList list = new LabelledList(includeAggregationMethodAttributes() ? "Add Data..." : "Redraw"); add(list, BorderLayout.CENTER); if (includeAggregationMethodAttributes()) { NumberTextField stepsField = new NumberTextField(1, true) { public double newValue(double value) { value = (long) value; if (value <= 0) return currentValue; else { interval = (long) value; return value; } } }; list.addLabelled("Every", stepsField); list.addLabelled("", new JLabel("...Timesteps")); String[] optionsLabel = {"Current", "Maximum", "Minimum", "Mean"}; final JComboBox optionsBox = new JComboBox(optionsLabel); optionsBox.setSelectedIndex(aggregationMethod); optionsBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { aggregationMethod = optionsBox.getSelectedIndex(); } }); list.addLabelled("Using", optionsBox); } String[] optionsLabel2 = new String[] { "When Adding Data", "Every 0.1 Seconds", "Every 0.5 Seconds", "Every Second", "Every 2 Seconds", "Every 5 Seconds", "Every 10 Seconds", "Never" }; final JComboBox optionsBox2 = new JComboBox(optionsLabel2); optionsBox2.setSelectedIndex(redraw); optionsBox2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { redraw = optionsBox2.getSelectedIndex(); generator.update(); // keep up-to-date } }); if (includeAggregationMethodAttributes()) list.addLabelled("Redraw", optionsBox2); else list.add(optionsBox2); }
private void loadPreferences() { // grab the preferences so that they can be used to fill out the layout ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance(); // x resolution text box xres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME)); // y resolution text box yres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME)); // aspect ratio checkbox aspect.setSelected( myPreferences .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME) .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING)); // load the color values from the preferences int redValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME); int greenValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME); int blueValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME); // set the background color image colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber)); // red slider red.setValue(redValueNumber); redValue.setText("" + redValueNumber); // green slider green.setValue(greenValueNumber); greenValue.setText("" + greenValueNumber); // blue slider blue.setValue(blueValueNumber); blueValue.setText("" + blueValueNumber); // algorithm combo box algorithm.setSelectedIndex( myPreferences.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME)); // format combo box format.setSelectedIndex( myPreferences.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME)); // prepend field prepend.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME)); // append field append.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME)); // output folder field output.setText( (new File(myPreferences.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME))) .getAbsolutePath()); }
private void lookupViewComboAction(ActionEvent e) { ObjEntityView fieldLookupView = objEntityViewField.getLookup().getLookupObjEntityView(); ObjEntityView selectedLookupView = (ObjEntityView) lookupViewCombo.getSelectedItem(); if (selectedLookupView != fieldLookupView) { objEntityViewField.getLookup().setLookupObjEntityView(selectedLookupView); dataViewTreeModel.fieldChanged(objEntityViewField); dataMapTreeModel.fieldChanged(objEntityViewField); fieldsTableModel.fireTableCellUpdated( objEntityViewField.getObjEntityView().getIndexOfObjEntityViewField(objEntityViewField), 4); } if (selectedLookupView != null) { ObjEntityViewField nullField = null; java.util.List lookupFields = new ArrayList(); lookupFields.add(nullField); lookupFields.addAll(selectedLookupView.getObjEntityViewFields()); DefaultComboBoxModel lookupFieldsDefaultModel = new DefaultComboBoxModel(lookupFields.toArray()); lookupFieldCombo.setModel(lookupFieldsDefaultModel); ObjEntityViewField fieldLookupField = objEntityViewField.getLookup().getLookupField(); if (fieldLookupField != null) { boolean flagSetSelectedItem = false; for (Iterator itr = lookupFields.iterator(); itr.hasNext(); ) { ObjEntityViewField field = (ObjEntityViewField) itr.next(); if ((field != null) && (fieldLookupField.getName().equals(field.getName()))) { lookupFieldCombo.setSelectedItem(fieldLookupField); flagSetSelectedItem = true; break; } } if (!flagSetSelectedItem) { lookupFieldCombo.setSelectedIndex(0); } } else { lookupFieldCombo.setSelectedIndex(0); } } else { ObjEntityViewField nullField = null; ObjEntityViewField[] fields = new ObjEntityViewField[] {nullField}; DefaultComboBoxModel fieldsModel = new DefaultComboBoxModel(fields); lookupFieldCombo.setModel(fieldsModel); lookupFieldCombo.setSelectedIndex(0); } }
public HeaderPanel(String heading) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(background); JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT); Font labelFont = new Font("Dialog", Font.BOLD, 18); panelLabel.setFont(labelFont); this.add(panelLabel); this.add(Box.createHorizontalGlue()); refresh = new JButton("Refresh"); refresh.addActionListener(this); this.add(refresh); this.add(Box.createHorizontalStrut(5)); root = new JComboBox(); Dimension d = root.getPreferredSize(); d.width = 90; root.setPreferredSize(d); root.setMaximumSize(d); File[] roots = directoryPane.getRoots(); for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath()); this.add(root); root.setSelectedIndex(directoryPane.getCurrentRootIndex()); root.addActionListener(this); this.add(Box.createHorizontalStrut(17)); }
public ComboBoxDemo() { super(new BorderLayout()); String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Pig"}; // Create the combo box, select the item at index 4. // Indices start at 0, so 4 specifies the pig. JComboBox petList = new JComboBox(petStrings); petList.setSelectedIndex(4); petList.addActionListener(this); // Set up the picture. picture = new JLabel(); picture.setFont(picture.getFont().deriveFont(Font.ITALIC)); picture.setHorizontalAlignment(JLabel.CENTER); updateLabel(petStrings[petList.getSelectedIndex()]); picture.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); // The preferred size is hard-coded to be the width of the // widest image and the height of the tallest image + the border. // A real program would compute this. picture.setPreferredSize(new Dimension(177, 122 + 10)); // Lay out the demo. add(petList, BorderLayout.PAGE_START); add(picture, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
/* * The following method resets the window to its original status. */ public void init() { sampleField.setText(new String("Big Java")); textField.setText(new String("Big Java")); facenameCombo.setSelectedIndex(0); sizeCombo.setSelectedIndex(2); italicCheckBox.setSelected(false); boldCheckBox.setSelected(false); // largeButton.setSelected(true); fontColor = Color.BLACK; setSampleFont(); } // end init method
@Override public void setSelectedIndex(int ind) { super.setSelectedIndex(ind); editor.setText(getItemAt(ind).toString()); editor.setSelectionEnd(caretPos + editor.getText().length()); editor.moveCaretPosition(caretPos); }
public SwingThreadFrame() { setTitle("SwingThreadTest"); final JComboBox combo = new JComboBox(); combo.insertItemAt(new Integer(Integer.MAX_VALUE), 0); combo.setPrototypeDisplayValue(combo.getItemAt(0)); combo.setSelectedIndex(0); JPanel panel = new JPanel(); JButton goodButton = new JButton("Good"); goodButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { new Thread(new GoodWorkerRunnable(combo)).start(); } }); panel.add(goodButton); JButton badButton = new JButton("Bad"); badButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { new Thread(new BadWorkerRunnable(combo)).start(); } }); panel.add(badButton); panel.add(combo); add(panel); pack(); }
public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source.equals(root)) { root.setSelectedIndex(directoryPane.changeRoot(root.getSelectedIndex())); } else if (source.equals(refresh)) { directoryPane.reloadTree(); } }
public void syncPanel() { if (SeaMark.EntMAP.get(dlg.panelMain.mark.getObject()) == Ent.MOORING) { mooringButton.setBorderPainted(true); categoryBox.setVisible(false); mooringBox.setVisible(true); pillarButton.setEnabled(false); sparButton.setEnabled(false); beaconButton.setEnabled(false); towerButton.setEnabled(false); stakeButton.setEnabled(false); cairnButton.setEnabled(false); noticeButton.setEnabled(false); topmarkButton.setVisible(false); for (Cat cat : moorings.keySet()) { int item = moorings.get(cat); if (dlg.panelMain.mark.getCategory() == cat) mooringBox.setSelectedIndex(item); } } else { mooringButton.setBorderPainted(false); mooringBox.setVisible(false); categoryBox.setVisible(true); pillarButton.setEnabled(true); sparButton.setEnabled(true); beaconButton.setEnabled(true); towerButton.setEnabled(true); stakeButton.setEnabled(true); cairnButton.setEnabled(true); noticeButton.setEnabled(true); topmarkButton.setBorderPainted(dlg.panelMain.mark.getTopmark() != Top.NOTOP); topmarkButton.setSelected(dlg.panelMain.mark.getTopmark() != Top.NOTOP); topmarkButton.setVisible(dlg.panelMain.mark.testValid()); for (Cat cat : categories.keySet()) { int item = categories.get(cat); if (dlg.panelMain.mark.getCategory() == cat) categoryBox.setSelectedIndex(item); } } for (Shp shp : shapes.keySet()) { JRadioButton button = shapes.get(shp); if (dlg.panelMain.mark.getShape() == shp) { button.setBorderPainted(true); } else button.setBorderPainted(false); } noticeButton.setBorderPainted(false); dlg.panelMain.mark.testValid(); }
private void objRelationshipComboAction(ActionEvent e) { ObjRelationship selectedObjRelationship = (ObjRelationship) objRelationshipCombo.getSelectedItem(); ObjRelationship fieldObjRelationship = objEntityViewField.getObjRelationship(); if (selectedObjRelationship != fieldObjRelationship) { objEntityViewField.setObjRelationship(selectedObjRelationship); } if (selectedObjRelationship != null) { ObjEntity targetObjEntity = selectedObjRelationship.getTargetObjEntity(); ObjEntityView nullView = null; java.util.List lookupViews = new ArrayList(); lookupViews.add(nullView); lookupViews.addAll(targetObjEntity.getObjEntityViews()); DefaultComboBoxModel lookupViewModel = new DefaultComboBoxModel(lookupViews.toArray()); lookupViewCombo.setModel(lookupViewModel); ObjEntityView fieldLookupView = objEntityViewField.getLookup().getLookupObjEntityView(); if (fieldLookupView != null) { boolean flagSetSelectedItem = false; for (Iterator itr = lookupViews.iterator(); itr.hasNext(); ) { ObjEntityView view = (ObjEntityView) itr.next(); if (fieldLookupView == view) { lookupViewCombo.setSelectedItem(fieldLookupView); flagSetSelectedItem = true; break; } } if (!flagSetSelectedItem) { lookupViewCombo.setSelectedIndex(0); } } else { lookupViewCombo.setSelectedIndex(0); } } else { ObjEntityView nullView = null; ObjEntityView[] views = new ObjEntityView[] {nullView}; DefaultComboBoxModel viewsModel = new DefaultComboBoxModel(views); lookupViewCombo.setModel(viewsModel); lookupViewCombo.setSelectedIndex(0); } }
public void setSelectedFormat(String format) { for (int i = 0; i < formatComboBox.getItemCount(); i++) { DataSourceQueryChooser chooser = (DataSourceQueryChooser) formatComboBox.getItemAt(i); if (chooser.toString().equals(format)) { formatComboBox.setSelectedIndex(i); return; } } }
/** Create the tabbed panels for the GUI */ private void createTabs() { // Create the tabbed pane mainPanel = new JTabbedPane(JTabbedPane.BOTTOM); // Create the various panels workspacePanel = new JPanel(new BorderLayout()); userListPanel = new JPanel(new BorderLayout()); searchPanel = new JPanel(new GridLayout(0, 2)); // Create the pieces of the workspace panel workspaceList.setLayoutOrientation(JList.VERTICAL_WRAP); workspacePanel.add(new JScrollPane(workspaceList)); workspacePanel.add(new JLabel("Local File Listing"), BorderLayout.NORTH); // Create the UserList tab JPanel labelPanel = new JPanel(new GridLayout(0, 2)); labelPanel.add(new JLabel("Users Connected:")); labelPanel.add(new JLabel("Selected User's Files:")); JPanel listPanel = new JPanel(new GridLayout(0, 2)); listPanel.add(new JScrollPane(userList)); listPanel.add(new JScrollPane(fileList)); userList.addMouseListener(mouseHandler); fileList.addMouseListener(mouseHandler); userListPanel.add(labelPanel, BorderLayout.NORTH); userListPanel.add(listPanel, BorderLayout.CENTER); // Create Search Panel searchPanel = new JPanel(new BorderLayout()); JPanel searchOpsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); searchName = new JTextField(20); searchInit = new JButton("Search"); searchInit.addMouseListener(mouseHandler); String types[] = {"Image", "Video", "Audio", "Any"}; searchType = new JComboBox(types); searchType.setSelectedIndex(3); searchOpsPanel.add(new JLabel("Search String")); searchOpsPanel.add(searchName); searchOpsPanel.add(new JLabel("File Type")); searchOpsPanel.add(searchType); searchOpsPanel.add(searchInit); searchPanel.add(new JScrollPane(searchList)); searchPanel.add(searchOpsPanel, BorderLayout.NORTH); // Add panels to the tab pane mainPanel.addTab("Home", workspacePanel); mainPanel.addTab("Server", userListPanel); mainPanel.addTab("Search", searchPanel); }
@Override public void layerChange(CPArtwork artwork) { if (artwork.getActiveLayer().getAlpha() != alphaSlider.value) { alphaSlider.setValue(artwork.getActiveLayer().getAlpha()); } if (artwork.getActiveLayer().getBlendMode() != blendCombo.getSelectedIndex()) { blendCombo.setSelectedIndex(artwork.getActiveLayer().getBlendMode()); } lw.repaint(); lw.revalidate(); }
public dialogAlterarCliente(Cliente cliente) { setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonOK); borderError = BorderFactory.createLineBorder(Color.red); borderDefault = txtNome.getBorder(); c = cliente; txtNome.setText(c.getNome()); txtCpf.setText(c.getCpf()); txtEndereco.setText(c.getEndereco()); txtEmail.setText(c.getEmail()); txtTelefone.setText(c.getTelefone()); cboxStatusCliente.setSelectedIndex(c.getStatus()); buttonOK.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); }
private void completePanel() { if (criterion != null) { jtfCode.setText(criterion.getCode()); jtfCode.setEditable(false); jtfLibelle.setText(criterion.getLibelle()); jcbSortOrder.setSelectedIndex((criterion.getSortOrder() > 0) ? 0 : 1); jcbPlacementCriterion.setSelected(criterion.isPlacement()); jcbClassementCriterion.setSelected(criterion.isClassement()); jcbSortOrder.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); jcbPlacementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); jcbClassementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); } }
private void updateData() { stockpile = null; stockpileItem = null; List<Item> itemsList = new ArrayList<Item>(StaticData.get().getItems().values()); Collections.sort(itemsList); try { items.getReadWriteLock().writeLock().lock(); items.clear(); items.addAll(itemsList); } finally { items.getReadWriteLock().writeLock().unlock(); } jItems.setSelectedIndex(0); jCountMinimum.setText(""); jItems.setEnabled(true); }
public Marketplace_Master() { this.setLayout(layout); for (int i = 0; i < textfield.length; i++) { label[i] = new JLabel(labels[i]); textfield[i] = new JTextField(20); this.add(label[i]); this.add(textfield[i]); textfield[i].addFocusListener(this); } label[5] = new JLabel(labels[5]); this.add(label[5]); combo = new JComboBox(trust); combo.setSelectedIndex(0); this.add(combo); this.setTextField(); layout.putConstraint(SpringLayout.WEST, label[0], 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[0], 10, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, textfield[0], 101, SpringLayout.EAST, label[0]); layout.putConstraint(SpringLayout.NORTH, textfield[0], 10, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, textfield[0], -10, SpringLayout.EAST, this); for (int i = 1; i < textfield.length; i++) { layout.putConstraint(SpringLayout.WEST, label[i], 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[i], 10, SpringLayout.SOUTH, textfield[i - 1]); layout.putConstraint(SpringLayout.WEST, textfield[i], 0, SpringLayout.WEST, textfield[i - 1]); layout.putConstraint( SpringLayout.NORTH, textfield[i], 10, SpringLayout.SOUTH, textfield[i - 1]); layout.putConstraint(SpringLayout.EAST, textfield[i], 0, SpringLayout.EAST, textfield[0]); } layout.putConstraint(SpringLayout.WEST, label[5], 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[5], 5, SpringLayout.SOUTH, textfield[4]); layout.putConstraint(SpringLayout.WEST, combo, 0, SpringLayout.WEST, textfield[4]); layout.putConstraint(SpringLayout.NORTH, combo, 5, SpringLayout.SOUTH, textfield[4]); layout.putConstraint(SpringLayout.EAST, combo, 0, SpringLayout.EAST, textfield[0]); layout.putConstraint(SpringLayout.SOUTH, this, 10, SpringLayout.SOUTH, combo); this.setVisible(false); }
public void secureMove() { int rw = tblItems.getSelectedRow(); if (rw == -1) { JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE); return; } int idx = tblItems.convertRowIndexToModel(rw); String[] opts = new String[storeLocs.size()]; for (int i = 0; i < opts.length; i++) opts[i] = storeLocs.get(i).getAbsolutePath(); JComboBox cmbMove = new JComboBox(opts); cmbMove.setSelectedIndex(store.curStore(idx)); if (JOptionPane.showConfirmDialog(frm, cmbMove, "Move item", JOptionPane.OK_CANCEL_OPTION) != JOptionPane.OK_OPTION) return; File newLoc = store.move(idx, cmbMove.getSelectedIndex()); if (newLoc == null) System.err.println("move " + store.plainName(idx) + " unsuccessful"); else needsSave = true; }
private void updateParams(EDPCellData data) { paramComboBox.removeAllItems(); paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor); if (!m_isCrawlRuleEditor) { paramComboBox.addItem(STRING_LITERAL); } for (Iterator it = paramKeys.values().iterator(); it.hasNext(); ) { ConfigParamDescr descr = (ConfigParamDescr) it.next(); int type = descr.getType(); if (!m_isCrawlRuleEditor && (type == ConfigParamDescr.TYPE_SET || type == ConfigParamDescr.TYPE_RANGE)) continue; paramComboBox.addItem(descr); } paramComboBox.setEnabled(true); paramComboBox.setSelectedIndex(0); paramComboBox.setToolTipText("Select a parameter to insert into the format string"); insertButton.setEnabled(true); }
/* * The following method creates the combo box with font size choices * postcondition: returns the panel containing the size combo box. */ public JPanel createSizeComboBox() { sizeCombo = new JComboBox(); sizeCombo.addItem(SMALLEST); sizeCombo.addItem(SMALL); sizeCombo.addItem(SMALL_MEDIUM); sizeCombo.addItem(MEDIUM); sizeCombo.addItem(MEDIUM_LARGE); sizeCombo.addItem(LARGE); sizeCombo.addItem(LARGEST); sizeCombo.addItem(HUGE); sizeCombo.addItem(WOW); sizeCombo.setEditable(true); // facenameCombo.addActionListener(this); sizeCombo.setSelectedIndex(2); JPanel panel = new JPanel(); panel.add(sizeCombo); panel.setBorder(new TitledBorder(new EtchedBorder(), "Font Name")); return panel; } // end createComboBox method
/** * Loads the account with the given identifier. * * @param accountID the account identifier */ public void loadAccount(AccountID accountID) { enableDefaultEncryption.setSelected( accountID.getAccountPropertyBoolean(ProtocolProviderFactory.DEFAULT_ENCRYPTION, true)); Map<String, Integer> encryptionProtocols = accountID.getIntegerPropertiesByPrefix(ProtocolProviderFactory.ENCRYPTION_PROTOCOL, true); Map<String, Boolean> encryptionProtocolStatus = accountID.getBooleanPropertiesByPrefix( ProtocolProviderFactory.ENCRYPTION_PROTOCOL_STATUS, true, false); this.loadEncryptionProtocols(encryptionProtocols, encryptionProtocolStatus); enableSipZrtpAttribute.setSelected( accountID.getAccountPropertyBoolean( ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true)); cboSavpOption.setSelectedIndex( accountID.getAccountPropertyInt( ProtocolProviderFactory.SAVP_OPTION, ProtocolProviderFactory.SAVP_OFF)); cipherModel.loadData( accountID.getAccountPropertyString(ProtocolProviderFactory.SDES_CIPHER_SUITES)); loadStates(); }
public MySimpleCal(JFrame owner, JTextField text, int t) { super(owner, true); this.plane_scheduler = t; System.out.println(plane_scheduler + "班期"); this.owner = owner; this.text = text; cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); panel = new JPanel(); initCalPanel(); JPanel southPanel = new JPanel(); btn = new JButton("确定"); southPanel.add(btn); SpinnerNumberModel snm = new SpinnerNumberModel(year, year - 10, year + 10, 1); yearSpi = new JSpinner(snm); // yearSpi.getEditor().setEnabled(false); String[] str = {"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"}; monthBox = new JComboBox(str); JPanel northPanel = new JPanel(); northPanel.add(yearSpi); northPanel.add(monthBox); monthBox.setSelectedIndex(month); this.setLayout(new BorderLayout()); this.add(northPanel, BorderLayout.NORTH); this.add(panel, BorderLayout.CENTER); this.add(southPanel, BorderLayout.SOUTH); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setResizable(false); this.setSize(310, 350); this.setMiddle(); this.addEventListener(); }
private void addPhone() { if (phone.getText().length() == 10) { if (carriers.getSelectedIndex() == 0) { Main.addPhone(phone.getText() + "@txt.att.net"); } if (carriers.getSelectedIndex() == 1) { Main.addPhone(phone.getText() + "@myboostmobile.com"); } if (carriers.getSelectedIndex() == 2) { Main.addPhone(phone.getText() + "@mobile.celloneusa.com"); } if (carriers.getSelectedIndex() == 3) { Main.addPhone(phone.getText() + "@messaging.nextel.com"); } if (carriers.getSelectedIndex() == 4) { Main.addPhone(phone.getText() + "@tmomail.net"); } if (carriers.getSelectedIndex() == 5) { Main.addPhone(phone.getText() + "@txt.att.net"); } if (carriers.getSelectedIndex() == 6) { Main.addPhone(phone.getText() + "@email.uscc.net"); } if (carriers.getSelectedIndex() == 7) { Main.addPhone(phone.getText() + "@messaging.sprintpcs.com"); } if (carriers.getSelectedIndex() == 8) { Main.addPhone(phone.getText() + "@vtext.com"); } if (carriers.getSelectedIndex() == 9) { Main.addPhone(phone.getText() + "@vmobl.com"); } displayInformation(); phone.setText(""); carriers.setSelectedIndex(0); } else { results.setText("Please add 10 digit cell number."); } }
protected void SetFields() { if (_CurrentPersonnel != null) { _NameTextField.setText(_CurrentPersonnel.getName()); _CallsignTextField.setText(_CurrentPersonnel.getCallsign()); _RankCombo.setSelectedIndex(_CurrentPersonnel.getRank().ordinal()); _RatingCombo.setSelectedIndex(_CurrentPersonnel.getRating().ordinal()); _JobTypeCombo.setSelectedIndex(_CurrentPersonnel.getJobType().ordinal()); _AssetAssignmentTextField.setText( _Unit.getAssetDetailForAssetAssignedToPersonnel(_CurrentPersonnel.getName())); _NotesTextArea.setText(_CurrentPersonnel.getNotes()); } else { _NameTextField.setText(""); _CallsignTextField.setText(""); _RankCombo.setSelectedIndex(-1); _HomePlanetCombo.setSelectedIndex(-1); _RatingCombo.setSelectedIndex(-1); _JobTypeCombo.setSelectedIndex(-1); _AssetAssignmentTextField.setText(""); _NotesTextArea.setText(""); } }