/** @see Editor#addSelectorForm() */ @Override public void addSelectorForm() { JComboBox<Bus> jcbBus; Bus[] buses = Bus.getBusArray(this); if (isDeleteOperation) { jcbBus = new JComboBox<Bus>(); jcbBus.setPreferredSize(fieldSize); for (Bus b : buses) { if (b.id != item.id) { jcbBus.addItem(b); } } } else { jcbBus = new JComboBox<Bus>(buses); jcbBus.setPreferredSize(fieldSize); jcbBus.setSelectedIndex(-1); if (item != null) { for (int i = 0; i < buses.length; i++) { if (buses[i].id == item.id) { jcbBus.setSelectedIndex(i); } } } } model = jcbBus; addField(TABLE_BUS_BUSID, model); }
/** * Sets the combo-boxes to a fixed size so they don't take up too much room that would be better * devoted to the test output box */ protected void setComboSizes() { m_DatasetKeyBut.setPreferredSize(COMBO_SIZE); m_RunCombo.setPreferredSize(COMBO_SIZE); m_ResultKeyBut.setPreferredSize(COMBO_SIZE); m_CompareCombo.setPreferredSize(COMBO_SIZE); m_SigTex.setPreferredSize(COMBO_SIZE); m_DatasetKeyBut.setMaximumSize(COMBO_SIZE); m_RunCombo.setMaximumSize(COMBO_SIZE); m_ResultKeyBut.setMaximumSize(COMBO_SIZE); m_CompareCombo.setMaximumSize(COMBO_SIZE); m_SigTex.setMaximumSize(COMBO_SIZE); m_DatasetKeyBut.setMinimumSize(COMBO_SIZE); m_RunCombo.setMinimumSize(COMBO_SIZE); m_ResultKeyBut.setMinimumSize(COMBO_SIZE); m_CompareCombo.setMinimumSize(COMBO_SIZE); m_SigTex.setMinimumSize(COMBO_SIZE); // =============== BEGIN EDIT melville =============== m_PrecTex.setPreferredSize(COMBO_SIZE); m_PrecTex.setMaximumSize(COMBO_SIZE); m_PrecTex.setMinimumSize(COMBO_SIZE); // =============== END EDIT melville =============== }
/* * @param parent the interval item's parent component */ private IntervalItemPanel(final IntervalPanel parent, final DataType type) { super(new GridLayout(1, 0)); m_parent = parent; m_bin = new JSpinner(createNumberModel(type)); m_bin.setPreferredSize(new Dimension(50, 25)); JSpinner.DefaultEditor editorBin = new JSpinner.NumberEditor(m_bin, "0.0##############"); editorBin.getTextField().setColumns(15); m_bin.setEditor(editorBin); m_bin.setPreferredSize(new Dimension(125, 25)); m_left = new JSpinner(createNumberModel(type)); JSpinner.DefaultEditor editorLeft = new JSpinner.NumberEditor(m_left, "0.0##############"); editorLeft.getTextField().setColumns(15); m_left.setEditor(editorLeft); m_left.setPreferredSize(new Dimension(125, 25)); m_right = new JSpinner(createNumberModel(type)); JSpinner.DefaultEditor editorRight = new JSpinner.NumberEditor(m_right, "0.0##############"); editorRight.getTextField().setColumns(15); m_right.setEditor(editorRight); m_right.setPreferredSize(new Dimension(125, 25)); m_borderLeft.setPreferredSize(new Dimension(50, 25)); m_borderLeft.setLightWeightPopupEnabled(false); m_borderLeft.addItem(RIGHT); m_borderLeft.addItem(LEFT); m_borderRight.setPreferredSize(new Dimension(50, 25)); m_borderRight.setLightWeightPopupEnabled(false); m_borderRight.addItem(LEFT); m_borderRight.addItem(RIGHT); }
private JPanel getContainer() { layout = new FlowLayout(); // Instanciation du layout layout.setAlignment(FlowLayout.CENTER); // On centre les composants container = new JPanel(); // On cr�e notre objet container.setLayout(layout); // On applique le layout textCycle.setEditable(false); textCycle.setPreferredSize(new Dimension(600, 200)); for (int k = 0; k < cycles.size(); k++) { textCycle.setText( textCycle.getText() + "Cycle no" + k + " :" + cycles.get(k).toString() + "\n" + "\n"); // On lui donne un texte container.add(textCycle); // On l'ajoute au container } btnPath = new JButton(); // Cr�ation du bouton btnPath.setPreferredSize(new Dimension(200, 25)); // On lui donne une taille btnPath.setText("Show path"); // On lui donne un texte btnPath.addActionListener(this); // On ajoute la fen�tre en tant qu'�couteur du bouton container.add(btnPath); // On l'ajoute � la fen�tre oneState = new JComboBox(listOneState); // On cr�e la liste en lui donnant un tableau d'op�rateurs oneState.setPreferredSize(new Dimension(140, 25)); // On lui donne une taille container.add(oneState); // on l'ajoute � la fen�tre twoStates = new JComboBox(listTwoStates); // On cr�e la liste en lui donnant un tableau d'op�rateurs twoStates.setPreferredSize(new Dimension(140, 25)); // On lui donne une taille container.add(twoStates); // on l'ajoute � la fen�tre btnCycle = new JButton(); // Cr�ation du bouton btnCycle.setPreferredSize(new Dimension(300, 25)); // On lui donne une taille btnCycle.setText("Show cycle"); // On lui donne un texte btnCycle.addActionListener(this); // On ajoute la fen�tre en tant qu'�couteur du bouton container.add(btnCycle); // On l'ajoute � la fen�tre cyclesBox = new JComboBox(listCycles); // On cr�e la liste en lui donnant un tableau d'op�rateurs cyclesBox.setPreferredSize(new Dimension(120, 25)); // On lui donne une taille container.add(cyclesBox); // on l'ajoute � la fen�tre btnReset = new JButton(); // Cr�ation du bouton btnReset.setPreferredSize(new Dimension(400, 25)); // On lui donne une taille btnReset.setText("Clear"); // On lui donne un texte btnReset.addActionListener(this); // On ajoute la fen�tre en tant qu'�couteur du bouton container.add(btnReset); // On l'ajoute � la fen�tre return container; }
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 JPanel creerHaut() { JPanel panneauHaut = new JPanel(); panneauHaut.setLayout(new BoxLayout(panneauHaut, BoxLayout.Y_AXIS)); JLabel fonction = new JLabel("STOCK"); fonction.setFont(new Font("Helvetica", Font.ITALIC, 48)); fonction.setAlignmentX(CENTER_ALIGNMENT); panneauHaut.add(Box.createRigidArea(new Dimension(0, 20))); panneauHaut.add(fonction); panneauHaut.add(Box.createRigidArea(new Dimension(0, 20))); JPanel cl = new JPanel(); JLabel client = new JLabel("Client: "); Vector<String> clients = cets.findAllClients(); comboClients = new JComboBox<String>(clients); comboClients.setPreferredSize(new Dimension(150, 20)); comboClients.setEditable(false); cl.add(client); cl.add(comboClients); ControlJComboBoxClientVanessaStock controlComboClients = new ControlJComboBoxClientVanessaStock(cets, this, modele); comboClients.addActionListener(controlComboClients); panneauHaut.add(cl); return panneauHaut; }
private void createComponents(JPanel p) { String tt = "Any of these: 45.5 -120.2 or 45 30 0 n 120 12 0 w or Seattle"; JComboBox field = new JComboBox(); field.setOpaque(false); field.setEditable(true); field.setLightWeightPopupEnabled(false); field.setPreferredSize(new Dimension(200, field.getPreferredSize().height)); field.setToolTipText(tt); JLabel label = new JLabel(ImageLibrary.getIcon("gov/nasa/worldwindow/images/safari-24x24.png")); // new // ImageIcon(getClass().getResource("gov/nasa/worldwindow/images/safari-24x24.png"))); label.setOpaque(false); label.setToolTipText(tt); p.add(label, BorderLayout.WEST); p.add(field, BorderLayout.CENTER); field.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { performGazeteerAction(actionEvent); } }); }
public GlobalControls() { setLayout(new GridBagLayout()); setBorder(new TitledBorder(new EtchedBorder(), "Global Controls")); aliasCB = createCheckBox("Anti-Aliasing", true, 0); renderCB = createCheckBox("Rendering Quality", false, 1); textureCB = createCheckBox("Texture", false, 2); compositeCB = createCheckBox("AlphaComposite", false, 3); screenCombo = new JComboBox(); screenCombo.setPreferredSize(new Dimension(120, 18)); screenCombo.setLightWeightPopupEnabled(true); screenCombo.setFont(font); for (int i = 0; i < screenNames.length; i++) { screenCombo.addItem(screenNames[i]); } screenCombo.addItemListener(this); Java2Demo.addToGridBag(this, screenCombo, 0, 4, 1, 1, 0.0, 0.0); toolBarCB = createCheckBox("Tools", false, 5); slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 30); slider.addChangeListener(this); TitledBorder tb = new TitledBorder(new EtchedBorder()); tb.setTitleFont(font); tb.setTitle("Anim delay = 30 ms"); slider.setBorder(tb); slider.setMinimumSize(new Dimension(80, 46)); Java2Demo.addToGridBag(this, slider, 0, 6, 1, 1, 1.0, 1.0); texturechooser = new TextureChooser(0); Java2Demo.addToGridBag(this, texturechooser, 0, 7, 1, 1, 1.0, 1.0); }
private JPanel createCallComboPanel() { JPanel callComboPanel = new JPanel(); callCombo = new JComboBox<Call>(); Dimension dim = callCombo.getPreferredSize(); // adjusting comboBox size. callCombo.setPreferredSize(new Dimension(275, dim.height)); populateCallCombo(); callComboPanel.add(callCombo); addCallButton = new JButton("Add Call.."); addCallButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { try { int callDuration = Integer.parseInt(JOptionPane.showInputDialog("Input Call Duration :")); PhoneInfoController.getInstance() .addCallForContact( selectedContactName, callDuration, Calendar.getInstance().getTime()); } catch (NumberFormatException ex) { JFrame outerFrame = new JFrame(); JOptionPane.showConfirmDialog(outerFrame, "Please enter a Number"); } dispose(); } }); callComboPanel.add(addCallButton); return callComboPanel; };
public ComSetting() { setLayout(null); JLabel ComLabel = new JLabel(Param.Label_Com_Port); ComLabel.setBounds(10, 10, 100, 20); add(ComLabel); comPortList = new JComboBox<String>(); updateComList(); comPortList.setPreferredSize(new Dimension(100, 20)); comPortList.setBounds(120, 10, 100, 20); add(comPortList); JButton ComButton = new JButton(Param.Label_Com_Update); ComButton.setBounds(240, 10, 100, 20); ComButton.addActionListener(this); add(ComButton); JLabel BaudLabel = new JLabel(Param.Label_Baud); BaudLabel.setBounds(10, 40, 100, 20); add(BaudLabel); Integer[] baud = {9600, 115200}; comBaudList = new JComboBox<Integer>(baud); comBaudList.setBounds(120, 40, 100, 20); add(comBaudList); }
public Container createSizeBox() { final JComboBox sizeBox = new JComboBox(size); sizeBox.setPreferredSize(sizeBox.getPreferredSize()); sizeBox.setEditor(new FixedBasicComboBoxEditor()); sizeBox.setEditable(true); return sizeBox; }
/** Initialize the layout for the combo box. */ private void init(Object[] items) { this.setTitle("Shell Command"); this.setResizable(false); this.setMinimumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setMaximumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); JPanel mainWindow = new JPanel(); mainWindow.setLayout(new BoxLayout(mainWindow, BoxLayout.Y_AXIS)); mainWindow.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); JLabel message = new JLabel("Please enter or select your shell command."); mainWindow.add(Box.createVerticalStrut(10)); JPanel messagePanel = new JPanel(); messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.X_AXIS)); messagePanel.add(message); mainWindow.add(messagePanel); mainWindow.add(Box.createVerticalStrut(5)); comboBox = new JComboBox(items); comboBox.setEditable(true); comboBox.addActionListener(this); comboBox.setPreferredSize(new Dimension(COMBO_BOX_WIDTH, COMBO_BOX_HEIGHT)); comboBox.setMinimumSize(new Dimension(COMBO_BOX_WIDTH, COMBO_BOX_HEIGHT)); comboBox.setMaximumSize(new Dimension(COMBO_BOX_WIDTH, COMBO_BOX_HEIGHT)); JPanel comboPane = new JPanel(); comboPane.setLayout(new BoxLayout(comboPane, BoxLayout.X_AXIS)); comboPane.add(comboBox); mainWindow.add(comboPane); mainWindow.add(Box.createVerticalStrut(5)); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); okButton = new JButton("OK"); okButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttonPane.add(cancelButton); buttonPane.add(okButton); mainWindow.add(buttonPane); mainWindow.add(Box.createVerticalStrut(5)); this.add(mainWindow); this.pack(); }
/** * Returned combobox should be - editable : user can input zoom value - using custom editor : To * Height will not displayed as "To Height" - NOT using custom renderer : To Height still * displayed as "To Height" on the dropdown menu * * @return a combo box */ private JComboBox getZoomDropdown() { if (zoomlist == null) { zoomlist = new JComboBox(); zoomlist.setPreferredSize(new Dimension(100, 15)); zoomlist.addActionListener(this); zoomlist.setEditable(true); zoomlist.setEditor(new ZoomComboBoxEditor()); } return zoomlist; }
/** * This method initializes jComboBoxPagoResto * * <p>return javax.swing.JComboBox */ private JComboBox getJComboBoxPagoResto() { if (jComboBoxPagoResto == null) { jComboBoxPagoResto = new JComboBox(); jComboBoxPagoResto.setBackground(new java.awt.Color(224, 224, 222)); jComboBoxPagoResto.setPreferredSize(new java.awt.Dimension(50, 20)); jComboBoxPagoResto.addItem(new LabelValueBean("SI", "0")); jComboBoxPagoResto.addItem(new LabelValueBean("NO", "99")); jComboBoxPagoResto.addKeyListener(this); } return jComboBoxPagoResto; }
/** * Sets the combo-boxes to a fixed size so they don't take up too much room that would be better * devoted to the test output box. */ protected void setComboSizes() { m_TesterClasses.setPreferredSize(COMBO_SIZE); m_PanelDatasetResultKeys.setPreferredSize(COMBO_SIZE); m_CompareCombo.setPreferredSize(COMBO_SIZE); m_SigTex.setPreferredSize(COMBO_SIZE); m_SortCombo.setPreferredSize(COMBO_SIZE); m_TesterClasses.setMaximumSize(COMBO_SIZE); m_PanelDatasetResultKeys.setMaximumSize(COMBO_SIZE); m_CompareCombo.setMaximumSize(COMBO_SIZE); m_SigTex.setMaximumSize(COMBO_SIZE); m_SortCombo.setMaximumSize(COMBO_SIZE); m_TesterClasses.setMinimumSize(COMBO_SIZE); m_PanelDatasetResultKeys.setMinimumSize(COMBO_SIZE); m_CompareCombo.setMinimumSize(COMBO_SIZE); m_SigTex.setMinimumSize(COMBO_SIZE); m_SortCombo.setMinimumSize(COMBO_SIZE); }
/** * Constructor for the LiveSearchBox. First create a pointer to the controller. Then create a * JComboBox, set the preferred size, set the setEditable to true, and set the background. The * component is retrieved from adress and sets a size. Finally a listener is added to component. */ public LiveSearchBox() { controller = Controller.getInstance(); adress = new JComboBox(); Dimension d = adress.getPreferredSize(); adress.setPreferredSize(new Dimension(170, (int) d.getHeight())); adress.setEditable(true); adress.setBackground(Color.lightGray); component = (JTextField) adress.getEditor().getEditorComponent(); component.setSize(50, 10); doc = component.getDocument(); listener = createListener(); doc.addDocumentListener(listener); }
private void init() { setLayout(new GridBagLayout()); setComponent(new JLabel("销售票号:"), 0, 0, 1, 0, false); piaohao.setFocusable(false); setComponent(piaohao, 1, 0, 1, 140, true); setComponent(new JLabel("客户:"), 2, 0, 1, 0, false); kehu.setFocusable(false); kehu.setPreferredSize(new Dimension(160, 21)); kehu.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } }); setComponent(kehu, 3, 0, 1, 0, true); setComponent(new JLabel("联系人:"), 4, 0, 1, 0, false); lianxiren.setFocusable(false); lianxiren.setPreferredSize(new Dimension(80, 21)); setComponent(lianxiren, 5, 0, 1, 0, true); setComponent(new JLabel("结算方式:"), 0, 1, 1, 0, false); jsfs.setFocusable(false); jsfs.setPreferredSize(new Dimension(160, 21)); jsfs.addItem("现金"); jsfs.addItem("支票"); jsfs.setEditable(true); setComponent(jsfs, 1, 1, 1, 0, true); setComponent(new JLabel("销售时间:"), 2, 1, 1, 0, false); shijian.setFocusable(false); shijian.setPreferredSize(new Dimension(160, 21)); date = new Date(); shijian.setText(date.toLocaleString()); setComponent(shijian, 3, 1, 1, 0, true); setComponent(new JLabel("经手人"), 4, 1, 1, 0, false); setComponent(getJsrComboBox(), 5, 1, 1, 0, true); initTable(); }
public ReferencePropertyWidget(boolean containedByListReferenceGUI) { this.containedByListReferenceGUI = containedByListReferenceGUI; // get Options m_comboBox = new JComboBox(); m_comboBox.setEditable(false); m_comboBox.setPreferredSize(new Dimension(300, 20)); // m_comboBox.setMinimumSize(new Dimension(260, 20)); m_comboBox.setMaximumSize(new Dimension(Short.MAX_VALUE, 20)); KeyStroke controlT = KeyStroke.getKeyStroke("control SPACE"); getTextField().getInputMap().put(controlT, controlT); getTextField().getActionMap().put(controlT, new CodeCompleteAction()); ToolTipManager.sharedInstance().registerComponent(m_comboBox); }
/* * Sets up a combo box with a list of all the UW buildings * The buildings are sorted alphabetically by abbreviated name */ public void setList(JComboBox<String> list) { Map<String, String> map = mapPanel.buildingNames(); // list = new JComboBox<String>(); list.setPreferredSize(new Dimension(360, 30)); Set<String> abbreviated = new TreeSet<String>(map.keySet()); for (String str : abbreviated) { String name = str + ": " + map.get(str); list.addItem(name); } }
public PlayerPanel() { super(); innerPanel.setLayout(new GridBagLayout()); final GridBagConstraints constraints = new GridBagConstraints(); constraints.insets.set(3, 3, 3, 3); for (int i = 0; i < MAXPLAYERS; i++) { final JCheckBox cb = new JCheckBox(); if (i < 4) { cb.setSelected(true); if (i < 2) { cb.setEnabled(false); } } final JTextField tf = new JTextField(); tf.setText("Player " + (i + 1)); tf.setPreferredSize(new Dimension(130, 20)); final JSpinner sp = new JSpinner(new SpinnerNumberModel(1500, 100, 1000000000, 100)); sp.setPreferredSize(new Dimension(100, 20)); final JComboBox co = new JComboBox(ControllerInfo.getControllers()); co.setPreferredSize(new Dimension(200, 20)); if (i > 0) { co.setSelectedIndex(3); } checkBoxes.add(cb); textFields.add(tf); spinners.add(sp); comboBoxes.add(co); constraints.gridy = i; constraints.gridx = 0; innerPanel.add(cb, constraints); constraints.gridx++; innerPanel.add(tf, constraints); constraints.gridx++; innerPanel.add(sp, constraints); constraints.gridx++; innerPanel.add(co, constraints); } innerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); add(innerPanel); }
private void buildResultsPanel() { if (results.length == 0) { JLabel desc = new JLabel("No Results Found!"); desc.setFont(boldFont); JPanel labelPanel = new JPanel(); labelPanel.setBorder(new EmptyBorder(20, 0, 18, 0)); labelPanel.add(desc); back = new JButton("Back"); back.setPreferredSize(new Dimension(70, 28)); back.addActionListener(this); quit = new JButton("Quit"); quit.setPreferredSize(new Dimension(70, 28)); quit.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.add(back); buttonPanel.add(quit); resultsPanel = new JPanel(); resultsPanel.setLayout(new BoxLayout(resultsPanel, BoxLayout.PAGE_AXIS)); resultsPanel.add(labelPanel); resultsPanel.add(buttonPanel); } else { JLabel desc = new JLabel("Select a Mapping from the Search Results:"); desc.setFont(boldFont); JPanel labelPanel = new JPanel(); labelPanel.add(desc); mappingSelector = new JComboBox<String>(results); mappingSelector.setPreferredSize(new Dimension(650, 28)); mappingSelector.setSelectedIndex(0); JPanel selectionPanel = new JPanel(); selectionPanel.add(mappingSelector); back = new JButton("Back"); back.setPreferredSize(new Dimension(70, 28)); back.addActionListener(this); select = new JButton("Select"); select.setPreferredSize(new Dimension(70, 28)); select.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.add(back); buttonPanel.add(select); resultsPanel = new JPanel(); resultsPanel.setLayout(new BoxLayout(resultsPanel, BoxLayout.PAGE_AXIS)); resultsPanel.add(labelPanel); resultsPanel.add(selectionPanel); resultsPanel.add(buttonPanel); } }
/** * This method initializes cmbType * * @return javax.swing.JComboBox * @uml.property name="cmbType" */ private JComboBox getCmbType() { if (cmbType == null) { cmbType = new JComboBox(); cmbType.setPreferredSize(new Dimension(31, 20)); cmbType.setModel(new DefaultComboBoxModel(SchoolType.values())); cmbType.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { currentSchool.setSchoolType((SchoolType) cmbType.getSelectedItem()); } }); } return cmbType; }
private void createPersonsPanel() { personsPanel = new JPanel(new GridBagLayout()); personLab = new JLabel("Persons"); GridBagConstraints plc = new GridBagConstraints(); plc.anchor = GridBagConstraints.LINE_START; plc.insets = new Insets(10, 10, 5, 0); personsPanel.add(personLab, plc); personsCombo = new JComboBox(); personsCombo.setPreferredSize(new Dimension(150, 30)); GridBagConstraints pcc = new GridBagConstraints(); pcc.gridy = 1; pcc.anchor = GridBagConstraints.LINE_START; pcc.insets = new Insets(5, 10, 5, 0); personsPanel.add(personsCombo, pcc); personsList = new JList(new DefaultListModel()); JScrollPane listScroll = new JScrollPane(personsList); listScroll.setPreferredSize(new Dimension(150, 150)); GridBagConstraints pc = new GridBagConstraints(); pc.gridy = 2; pc.gridheight = 3; pc.gridwidth = 2; pc.insets = new Insets(5, 10, 0, 5); personsPanel.add(listScroll, pc); plusPerson = new JButton("+"); // plusPerson.setPreferredSize(new Dimension(33, 29)); GridBagConstraints ppc = new GridBagConstraints(); ppc.gridx = 2; ppc.gridy = 3; ppc.weighty = 1; ppc.insets = new Insets(0, 0, 5, 5); ppc.anchor = GridBagConstraints.PAGE_END; personsPanel.add(plusPerson, ppc); minusPerson = new JButton("-"); // minusPerson.setPreferredSize(new Dimension(33, 29)); GridBagConstraints mpc = new GridBagConstraints(); mpc.gridx = 2; mpc.gridy = 4; mpc.weighty = 1; mpc.insets = new Insets(5, 0, 0, 5); mpc.anchor = GridBagConstraints.PAGE_START; personsPanel.add(minusPerson, mpc); }
public void operationSurComposants() { // Liste des fichiers STC_Fichiers.setText(Bundle.getText("BD_ImporterProcessus_liste")); // Parcourir BP_Parcourir.setMnemonic(Bundle.getChar("parcourir_mne")); BP_Parcourir.setText(Bundle.getText("parcourir")); BP_Parcourir.addActionListener(actionParcourir); // Chemin STC_Chemin.setText(Bundle.getText("BD_ImporterProcessus_chemin")); LD_Chemin.setPreferredSize(new Dimension(350, 24)); LD_Chemin.setEditable(true); LD_Chemin.addActionListener(actionRechercher); // Rechercher BP_Rechercher.setText(Bundle.getText("BD_ImporterProcessus_rechercher")); BP_Rechercher.addActionListener(actionRechercher); }
private void setYearComboBox(Calendar c) { int y = c.get(Calendar.YEAR); years = new Integer[7]; for (int i = y - 3, j = 0; i <= y + 3; i++, j++) { years[j] = new Integer(i); } if (yearBox == null) { yearBox = new JComboBox(); yearBox.addActionListener(this); yearBox.setFont(DatePicker.plain); yearBox.setSize(yearBox.getWidth(), height); yearBox.setPreferredSize(new Dimension(yearBox.getWidth(), height)); } yearBox.setModel(new DefaultComboBoxModel(years)); yearBox.setSelectedItem(years[3]); }
private void createGroupPanel() { groupPanel = new JPanel(new GridBagLayout()); groupLab = new JLabel("Group"); GridBagConstraints glc = new GridBagConstraints(); glc.anchor = GridBagConstraints.LINE_START; glc.insets = new Insets(10, 10, 5, 0); groupPanel.add(groupLab, glc); groupCombo = new JComboBox(); groupCombo.setPreferredSize(new Dimension(150, 30)); GridBagConstraints gcc = new GridBagConstraints(); gcc.gridy = 1; gcc.anchor = GridBagConstraints.LINE_START; gcc.insets = new Insets(5, 10, 5, 0); groupPanel.add(groupCombo, gcc); groupList = new JList(new DefaultListModel()); JScrollPane groupListScroll = new JScrollPane(groupList); groupListScroll.setPreferredSize(new Dimension(150, 150)); GridBagConstraints gc = new GridBagConstraints(); gc.gridy = 2; gc.gridheight = 3; gc.gridwidth = 2; gc.insets = new Insets(5, 10, 0, 5); groupPanel.add(groupListScroll, gc); plusGroup = new JButton("+"); // plusGroup.setPreferredSize(new Dimension(33, 29)); GridBagConstraints pgc = new GridBagConstraints(); pgc.gridx = 2; pgc.gridy = 3; pgc.weighty = 1; pgc.insets = new Insets(0, 0, 5, 5); pgc.anchor = GridBagConstraints.PAGE_END; groupPanel.add(plusGroup, pgc); minusGroup = new JButton("-"); // minusGroup.setPreferredSize(new Dimension(33, 29)); GridBagConstraints mgc = new GridBagConstraints(); mgc.gridx = 2; mgc.gridy = 4; mgc.weighty = 1; mgc.insets = new Insets(5, 0, 0, 5); mgc.anchor = GridBagConstraints.PAGE_START; groupPanel.add(minusGroup, mgc); }
protected void addMediaTypeCombo(JXToolBar toolbar) { mediaTypeCombo = new JComboBox(getRequestMediaTypes()); mediaTypeCombo.setPreferredSize(new Dimension(120, 20)); mediaTypeCombo.setEnabled(httpRequest.hasRequestBody()); mediaTypeCombo.setEditable(true); if (httpRequest.getMediaType() != null) mediaTypeCombo.setSelectedItem(httpRequest.getMediaType()); mediaTypeCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { httpRequest.setMediaType(String.valueOf(mediaTypeCombo.getSelectedItem())); } }); toolbar.addLabeledFixed("Media Type", mediaTypeCombo); }
{ String encoding = RapidMiner.SYSTEM_ENCODING_NAME; String encodingProperty = ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_GENERAL_DEFAULT_ENCODING); if (encodingProperty != null) { encoding = encodingProperty; } encodingComboBox.setSelectedItem(encoding); encodingComboBox.setPreferredSize(new Dimension(encodingComboBox.getPreferredSize().width, 25)); encodingComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { settingsChanged(); } }); }
public SignDialog(JDialog parent) { super(parent, "Sign Message", Dialog.ModalityType.DOCUMENT_MODAL); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); String[] keyLabels = new String[BTCLoader.keys.size()]; int index = 0; for (ECKey key : BTCLoader.keys) { keyLabels[index++] = key.getLabel(); } nameField = new JComboBox<Object>(keyLabels); nameField.setPreferredSize(new Dimension(200, 25)); JPanel namePane = new JPanel(); namePane.add(new JLabel("Key ", JLabel.RIGHT)); namePane.add(nameField); messageField = new JTextArea(10, 70); messageField.setLineWrap(true); messageField.setWrapStyleWord(true); messageField.setFont(nameField.getFont()); scrollPane = new JScrollPane(messageField); JPanel messagePane = new JPanel(); messagePane.add(new JLabel("Message ", JLabel.RIGHT)); messagePane.add(scrollPane); signatureField = new JTextField("", 70); signatureField.setEditable(false); JPanel signaturePane = new JPanel(); signaturePane.add(new JLabel("Signature ", JLabel.RIGHT)); signaturePane.add(signatureField); JPanel buttonPane = new ButtonPane( this, 10, new String[] {"Sign", "sign"}, new String[] {"Copy", "copy"}, new String[] {"Done", "done"}); JPanel contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.setOpaque(true); contentPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); contentPane.add(namePane); contentPane.add(Box.createVerticalStrut(15)); contentPane.add(messagePane); contentPane.add(Box.createVerticalStrut(15)); contentPane.add(signaturePane); contentPane.add(Box.createVerticalStrut(15)); contentPane.add(buttonPane); setContentPane(contentPane); }
/** * adds comboBox to fxz composer toolbar * * @param toolbar Toolbar to add comboBox at * @param comboBox comboBox to add * @param index the position in the container's list at which to insert the component; <code>-1 * </code> means insert at the end component * @param isEditable is comboBox editable */ public static void addCombo(JToolBar toolbar, JComboBox comboBox, int index, boolean isEditable) { GridBagConstraints constrains = new GridBagConstraints(); constrains.anchor = GridBagConstraints.WEST; constrains.insets = new Insets(0, 3, 0, 2); // @inherited fix of issue #69642. Focus shouldn't stay in toolbar comboBox.setFocusable(false); Dimension size = comboBox.getPreferredSize(); comboBox.setPreferredSize(size); comboBox.setSize(size); comboBox.setMinimumSize(size); comboBox.setMaximumSize(size); comboBox.setEditable(isEditable); toolbar.add(comboBox, constrains, index); }