public void display(ResultSet rs) { try { boolean recordNumber = rs.next(); if (recordNumber) { payNo = rs.getString(1); pasNo = rs.getString(2); pasName = rs.getString(3); mode = rs.getString(4); dt = rs.getString(5); amount = rs.getString(6); rev = rs.getString(7); text1.setText(payNo); combo1.setSelectedItem(pasNo); combo2.setSelectedItem(pasName); combo4.setSelectedItem(mode); p_date.setText(dt); combo8.setSelectedItem(amount); combo3.setSelectedItem(rev); } else { JOptionPane.showMessageDialog( null, "Record Not found", "ERROR", JOptionPane.DEFAULT_OPTION); } } catch (SQLException sqlex) { sqlex.printStackTrace(); } }
/** * return the String id of the chosen server name * * @return the server name */ public String getServer() { Object selected = serverSelector.getSelectedItem(); if (selected == null) { return null; } AddeServer server; if (selected instanceof AddeServer) { server = (AddeServer) selected; return server.getName(); } String serverName = selected.toString(); server = getIdv().getIdvChooserManager().addAddeServer(serverName); addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType()); Object selectedGroup = groupSelector.getSelectedItem(); AddeServer.Group group = null; if (selectedGroup != null) { group = getIdv() .getIdvChooserManager() .addAddeServerGroup(server, selectedGroup.toString(), getGroupType()); } boolean old = ignoreStateChangedEvents; ignoreStateChangedEvents = true; GuiUtils.setListData(serverSelector, addeServers); serverSelector.setSelectedItem(server); setGroups(); if (group != null) { groupSelector.setSelectedItem(group); } ignoreStateChangedEvents = old; return server.getName(); }
/** * Set calendar to this week's Monday; set year and week combo boxes to the currently set date; * set the date labels appropriately; and, refresh the review table. */ private void updateYearWeekDates() { yearWeekCalendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); yearWeekCalendar.set(Calendar.HOUR_OF_DAY, 0); yearWeekCalendar.set(Calendar.MINUTE, 0); yearWeekCalendar.set(Calendar.SECOND, 0); yearWeekCalendar.set(Calendar.MILLISECOND, 0); yearCB.setSelectedItem(yearWeekCalendar.get(Calendar.YEAR)); weekCB.setSelectedItem(yearWeekCalendar.get(Calendar.WEEK_OF_YEAR)); fromDate.setDate(yearWeekCalendar); yearWeekCalendar.add(Calendar.DAY_OF_MONTH, 7); toDate.setDate(yearWeekCalendar); yearWeekCalendar.add(Calendar.DAY_OF_MONTH, -7); refreshReviewTable(); }
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); } }
/** * Get the image group from the gui. * * @return The iamge group. */ protected String getGroup() { Object selected = groupSelector.getSelectedItem(); if (selected == null) { return null; } if (selected instanceof AddeServer.Group) { AddeServer.Group group = (AddeServer.Group) selected; return group.getName(); } String groupName = selected.toString().trim(); if ((groupName.length() > 0)) { // Force the get in case they typed a server name getServer(); AddeServer server = getAddeServer(); if (server != null) { AddeServer.Group group = getIdv().getIdvChooserManager().addAddeServerGroup(server, groupName, getGroupType()); if (!group.getActive()) { getIdv().getIdvChooserManager().activateAddeServerGroup(server, group); } // Now put the list of groups back in to the selector setGroups(); groupSelector.setSelectedItem(group); } } return groupName; }
@Override public void keyPressed(KeyEvent evt) { if (evt.isConsumed()) return; Component comp = getFocusOwner(); if (evt.getKeyCode() == KeyEvent.VK_ENTER && enterEnabled) { while (comp != null) { if (comp instanceof JComboBox) { JComboBox<?> combo = (JComboBox<?>) comp; if (combo.isEditable()) { Object selected = combo.getEditor().getItem(); if (selected != null) combo.setSelectedItem(selected); } if (combo.isPopupVisible()) { evt.consume(); combo.setPopupVisible(false); } return; } // TODO: add other classes that need custom key handling here. comp = comp.getParent(); } evt.consume(); ok(); } else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE || isCloseBufferShortcut(evt)) { evt.consume(); if (comp instanceof JComboBox) { JComboBox<?> combo = (JComboBox<?>) comp; if (combo.isPopupVisible()) combo.setPopupVisible(false); else cancel(); } else cancel(); } }
public DataSourceQueryChooserDialog( Collection dataSourceQueryChoosers, Frame frame, String title, boolean modal) { super(frame, title, modal); init(dataSourceQueryChoosers); try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { okCancelPanel.setOKPressed(false); } }); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { // User may have hit OK, got a validation-error dialog, then hit the // X button. [Jon Aquino] okCancelPanel.setOKPressed(false); } }); // Set the selected item to trigger the event that sets the panel. [Jon Aquino] formatComboBox.setSelectedItem(formatComboBox.getItemAt(0)); }
/** * _more_ * * @param values _more_ * @return _more_ */ public JComboBox getFileCountWidget(int[] values) { if (fileCountWidget == null) { TwoFacedObject selected = null; Vector items = new Vector(); for (int i = 0; i < values.length; i++) { String label; if (values[i] == Integer.MAX_VALUE) { label = "All Files"; } else if (values[i] == 0) { label = "Use Selected File"; } else if (values[i] == 1) { label = "Use Most Recent File"; } else { label = "Use Most Recent " + values[i] + " Files"; } TwoFacedObject tfo = new TwoFacedObject(label, new Integer(values[i])); if (values[i] == fileCount) { selected = tfo; } items.add(tfo); } fileCountWidget = new JComboBox(items); if (selected == null) { selected = new TwoFacedObject("Use Most Recent " + fileCount + " Files", new Integer(fileCount)); } fileCountWidget.setSelectedItem(selected); } return fileCountWidget; }
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); } }
public void setup(String type, int channel, int cc, int min, int max) { // setType(type); typeList.setSelectedItem(type); this.channel.setValue(channel); this.cc.setValue(cc); this.min.setValue(min); this.max.setValue(max); }
protected JComboBox createCombo(String strText, JPanel pnlDisplay) { JComboBox cmbMode = new JComboBox(m_aStrMode); if (!strText.equalsIgnoreCase(m_aStrMode[0]) && !strText.equalsIgnoreCase(m_aStrMode[1])) strText = m_aStrMode[0]; cmbMode.setSelectedItem(strText); pnlDisplay.add(cmbMode); return cmbMode; }
private void extraInit() { addSynapses(); jTextFieldDelay.setText(mySynProps.getDelayGenerator().toShortString()); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); jTextFieldThreshold.setText(mySynProps.getThreshold() + ""); jComboBoxSynapseType.setSelectedItem(mySynProps.getSynapseType()); }
// Вид формы при изменении сотрудника public void sotrDiaUpdate(Sotrudnik s) { label_id_hidden.setText(Integer.toString(s.getId_sotrudnika())); textField_familiya.setText(s.getFamiliya()); textField_imya.setText(s.getImya()); textField_otchestvo.setText(s.getOtchestvo()); textField_phone.setText(s.getPhone()); textField_date.setText(s.getData_priema().toString()); comboBox_doljnost.removeAllItems(); comboBox_kvalification.removeAllItems(); try { DBClass db = new DBClass(); ArrayList<Doljnost> d = db.doljnostFromDB(); DBClass db2 = new DBClass(); Doljnost dd = db2.doljnostFromDB(s); for (int i = 0; i < d.size(); i++) { comboBox_doljnost.addItem(d.get(i)); Doljnost ddd = (Doljnost) comboBox_doljnost.getItemAt(i); if (dd.getNazvanie_doljnosti().equals(ddd.getNazvanie_doljnosti())) dd = ddd; } comboBox_doljnost.setSelectedItem(dd); DBClass db3 = new DBClass(); ArrayList<Kvalification> k = db3.kvalificationFromDB(); DBClass db4 = new DBClass(); Kvalification kk = db4.kvalificationFromDB(s); for (int i = 0; i < k.size(); i++) { comboBox_kvalification.addItem(k.get(i)); Kvalification kkk = (Kvalification) comboBox_kvalification.getItemAt(i); if (kk.getNazvanie_kvalification().equals(kkk.getNazvanie_kvalification())) kk = kkk; } comboBox_kvalification.setSelectedItem(kk); } catch (ClassNotFoundException e) { e.printStackTrace(); JOptionPane.showMessageDialog(panelException, e.getMessage()); } catch (SQLException ee) { ee.printStackTrace(); JOptionPane.showMessageDialog(panelException, ee.getMessage()); } }
StockpileItem showEdit(final StockpileItem addStockpileItem) { updateData(); this.stockpileItem = addStockpileItem; this.getDialog().setTitle(TabsStockpile.get().editStockpileItem()); Item item = StaticData.get().getItems().get(addStockpileItem.getTypeID()); jItems.setSelectedItem(item); jCopy.setSelected(addStockpileItem.isBPC()); jCountMinimum.setText(String.valueOf(addStockpileItem.getCountMinimum())); show(); return stockpileItem; }
public static void refreshCalendar(int month, int year) { // instantiation String[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; int numoday, startom; // Number Of Days, Start Of Month // Allow/disallow buttons prev.setEnabled(true); next.setEnabled(true); if (month == 0 && year <= ryear) { prev.setEnabled(false); } // Cannot set an appointment back in time if (month == 11 && year >= ryear + 50) { next.setEnabled(false); } // Too early to set an appointment lmonth.setText(months[month]); // Refresh the month label (at the top) lmonth.setBounds( 160 - lmonth.getPreferredSize().width / 2, 25, 180, 25); // Re-align label with calendar cyear.setSelectedItem(String.valueOf(year)); // Select the correct year in the combo box // deletes current table for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { mcal.setValueAt(null, i, j); } } // Get first day of month and number of days GregorianCalendar cal = new GregorianCalendar(year, month, 1); numoday = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH); startom = cal.get(GregorianCalendar.DAY_OF_WEEK); // Create calendar for (int i = 1; i <= numoday; i++) { int row = new Integer((i + startom - 2) / 7); int column = (i + startom - 2) % 7; mcal.setValueAt(i, row, column); } // Apply renderers Cal.setDefaultRenderer(Cal.getColumnClass(0), new tblCalendarRenderer()); }
/** * Изменить масштаб * * @param unit Шаг изменения */ public void setZoomItem(int unit) { // int index = cmbScale.getSelectedIndex(); // index += unit; // if ( index > -1 && index < cmbScale.getItemCount() ) // { // cmbScale.setSelectedIndex( index ); // } String txtScale = cmbScale.getSelectedItem().toString(); int newScale = parseScale(txtScale); newScale = newScale + (100 * unit); cmbScale.setSelectedItem("1:" + newScale); }
/** Load any saved server state */ private void loadServerState() { if (addeServers == null) { return; } String id = getId(); String[] serverState = (String[]) getIdv().getStore().get(PREF_SERVERSTATE + "." + id); if (serverState == null) { return; } AddeServer server = AddeServer.findServer(addeServers, serverState[0]); if (server == null) { return; } serverSelector.setSelectedItem(server); setGroups(); if (serverState[1] != null) { AddeServer.Group group = (AddeServer.Group) server.findGroup(serverState[1]); if (group != null) { groupSelector.setSelectedItem(group); } } }
/** Set the group list */ protected void setGroups() { AddeServer server = getAddeServer(); if (server != null) { Object selected = groupSelector.getSelectedItem(); List groups = server.getGroupsWithType(getGroupType()); GuiUtils.setListData(groupSelector, groups); if ((selected != null) && groups.contains(selected)) { groupSelector.setSelectedItem(selected); } } else { GuiUtils.setListData(groupSelector, new Vector()); } }
public void updateValues() { nameField.setText(parameter.getName()); labelField.setText(parameter.getLabel()); helpTextField.setText(parameter.getHelpText()); widgetBox.setSelectedItem(getHumanizedWidget(parameter.getWidget())); valueField.setText(parameter.getValue().toString()); enableIfField.setText(parameter.getEnableExpression()); Parameter.BoundingMethod boundingMethod = parameter.getBoundingMethod(); boundingMethodBox.setSelectedItem(boundingMethod.toString().toLowerCase(Locale.US)); Object minimumValue = parameter.getMinimumValue(); String minimumValueString = minimumValue == null ? "" : minimumValue.toString(); minimumValueCheck.setSelected(minimumValue != null); minimumValueField.setText(minimumValueString); minimumValueField.setEnabled(minimumValue != null); Object maximumValue = parameter.getMaximumValue(); String maximumValueString = maximumValue == null ? "" : maximumValue.toString(); maximumValueCheck.setSelected(maximumValue != null); maximumValueField.setText(maximumValueString); maximumValueField.setEnabled(maximumValue != null); displayLevelBox.setSelectedItem(parameter.getDisplayLevel().toString().toLowerCase(Locale.US)); menuItemsTable.tableChanged(new TableModelEvent(menuItemsTable.getModel())); revalidate(); }
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 int showCustomDialog(Frame f, Font fontArg, Color foreColorArg, Color backColorArg) { this.setLocationRelativeTo(f); String s = fontArg.getName(); fontCombo.setSelectedItem((Object) s); int style = fontArg.getStyle(); if ((style & Font.ITALIC) == 0) italic.setSelected(false); else italic.setSelected(true); if ((style & Font.BOLD) == 0) bold.setSelected(false); else bold.setSelected(true); int size = fontArg.getSize(); sizeCombo.setSelectedItem((Object) ("" + size)); example.setFont(fontArg); example.setForeground(MenuBar.shapeLBG.getBackground()); // show the dialog this.setVisible(true); return response; }
/** * Set the fields from the ProjectionClass * * @param projClass projection class to use */ private void setFieldsWithClassParams(ProjectionClass projClass) { // set the projection in the JComboBox String want = projClass.toString(); for (int i = 0; i < projClassCB.getItemCount(); i++) { ProjectionClass pc = (ProjectionClass) projClassCB.getItemAt(i); if (pc.toString().equals(want)) { projClassCB.setSelectedItem((Object) pc); break; } } // set the parameter fields paramPanel.removeAll(); paramPanel.setVisible(0 < projClass.paramList.size()); List widgets = new ArrayList(); for (int i = 0; i < projClass.paramList.size(); i++) { ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i); // construct the label String name = pp.name; String text = ""; // Create a decent looking label for (int cIdx = 0; cIdx < name.length(); cIdx++) { char c = name.charAt(cIdx); if (cIdx == 0) { c = Character.toUpperCase(c); } else { if (Character.isUpperCase(c)) { text += " "; c = Character.toLowerCase(c); } } text += c; } widgets.add(GuiUtils.rLabel(text + ": ")); // text input field JTextField tf = new JTextField(); pp.setTextField(tf); tf.setColumns(12); widgets.add(tf); } GuiUtils.tmpInsets = new Insets(4, 4, 4, 4); JPanel widgetPanel = GuiUtils.doLayout(widgets, 2, GuiUtils.WT_N, GuiUtils.WT_N); paramPanel.add("North", widgetPanel); paramPanel.add("Center", GuiUtils.filler()); }
/** * Handle any Gui actions. * * @param ae The <code>ActionEvent</code>. */ public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); if (cmd.equals(CMD_BROWSE)) { String filename = FileManager.getReadFile(FILTER_XML); if (filename == null) { return; } urlBox.setSelectedItem(filename); } else if (cmd.equals(GuiUtils.CMD_OK)) { doLoad(); } else { // Here, the base class ChooserPanel will check if this command // is the load or cancel command. super.actionPerformed(ae); } }
/** Reload the list of servers if they have changed */ public void updateServerList() { boolean old = ignoreStateChangedEvents; ignoreStateChangedEvents = true; List newList = getIdv().getIdvChooserManager().getAddeServers(getGroupType()); if (Misc.equals(newList, this.addeServers)) { ignoreStateChangedEvents = old; return; } this.addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType()); Object selected = serverSelector.getSelectedItem(); GuiUtils.setListData(serverSelector, addeServers); if ((selected != null) && addeServers.contains(selected)) { serverSelector.setSelectedItem(selected); } setGroups(); ignoreStateChangedEvents = old; }
public void keyReleased(KeyEvent e) { char ch = e.getKeyChar(); if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch)) return; int pos = m_editor.getCaretPosition(); String str = m_editor.getText(); if (str.length() == 0) return; for (int k = 0; k < m_comboBox.getItemCount(); k++) { String item = m_comboBox.getItemAt(k).toString(); if (item.startsWith(str)) { m_editor.setText(item); m_editor.setCaretPosition(item.length()); m_editor.moveCaretPosition(pos); m_comboBox.setSelectedItem(item); break; } } }
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); } }
private boolean addSynapses() { // ModFile[] inbuiltSynapses = ModFileHelper.getSynapseModFilesInDir(new // File(GeneralProperties.getModTemplateDirectory())); Vector synapticTypes = project.cellMechanismInfo.getAllChemElecSynMechNames(); for (int i = 0; i < synapticTypes.size(); i++) { jComboBoxSynapseType.addItem(synapticTypes.elementAt(i)); if (this.mySynProps.getSynapseType().equals(synapticTypes.elementAt(i))) { jComboBoxSynapseType.setSelectedItem(synapticTypes.elementAt(i)); } } /* ModFile[] mods = null; File neuronCodeDir = new File(project.getProjectFile() + System.getProperty("file.separator") + GeneralProperties.getDirForNeuronCode()); mods = ModFileHelper.getSynapseModFilesInDir(neuronCodeDir); for (int i = 0; i < mods.length; i++) { jComboBoxSynapseType.addItem(mods[i]); if (this.mySynProps.synapseType.equals(mods[i].myNeuronElement.getProcessName())) { jComboBoxSynapseType.setSelectedItem(mods[i]); } } */ return true; }
private void initStart() { // setResizable(false); setLayout(null); jlb = new JLabel("참여 인원수를 선택하세요"); jlb.setBounds(7, 7, 160, 20); jcb = new JComboBox(); for (int i = 2; i <= 10; i++) jcb.addItem(i); jcb.setSelectedItem(6); jcb.setMaximumRowCount(9); jcb.setBounds(50, 34, 70, 20); start_bt = new JButton("Start"); start_bt.setBounds(45, 62, 80, 30); con.add(jlb); con.add(start_bt); con.add(jcb); start_bt.addActionListener(this); jcb.addActionListener(this); setVisible(true); }
private JPanel makeInteriorAttributesPanel() { JPanel outerPanel = new JPanel(new BorderLayout(6, 6)); outerPanel.setBorder(this.createTitleBorder("Surface Attributes")); GridLayout nameLayout = new GridLayout(0, 1, 6, 6); JPanel namePanel = new JPanel(nameLayout); GridLayout valueLayout = new GridLayout(0, 1, 6, 6); JPanel valuePanel = new JPanel(valueLayout); namePanel.add(new JLabel("Style")); final JComboBox cb1 = new JComboBox(new String[] {"None", "Solid"}); cb1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentInteriorStyle = (String) cb1.getSelectedItem(); update(); } }); cb1.setSelectedItem("Solid"); valuePanel.add(cb1); namePanel.add(new JLabel("Opacity")); JSpinner sp = new JSpinner(new SpinnerNumberModel(this.currentBorderOpacity, 0, 10, 1)); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { currentInteriorOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue(); update(); } }); valuePanel.add(sp); namePanel.add(new JLabel("Color")); final JComboBox cb2 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"}); cb2.setSelectedItem(currentInteriorColor); cb2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentInteriorColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem(); update(); } }); valuePanel.add(cb2); namePanel.add(new JLabel("Border")); final JComboBox cb5 = new JComboBox(new String[] {"None", "Solid"}); cb5.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentBorderStyle = (String) cb5.getSelectedItem(); update(); } }); cb5.setSelectedItem("Solid"); valuePanel.add(cb5); namePanel.add(new JLabel("Border Width")); sp = new JSpinner(new SpinnerNumberModel(this.currentBorderWidth, 1d, 10d, 1d)); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { currentBorderWidth = (Double) ((JSpinner) changeEvent.getSource()).getValue(); update(); } }); sp.setValue(currentBorderWidth); valuePanel.add(sp); namePanel.add(new JLabel("Border Color")); JComboBox cb4 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"}); cb4.setSelectedItem(currentBorderColor); cb4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentBorderColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem(); update(); } }); valuePanel.add(cb4); namePanel.add(new JLabel("Border Opacity")); sp = new JSpinner(new SpinnerNumberModel(this.currentBorderOpacity, 0, 10, 1)); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { currentBorderOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue(); update(); } }); valuePanel.add(sp); outerPanel.add(namePanel, BorderLayout.WEST); outerPanel.add(valuePanel, BorderLayout.CENTER); return outerPanel; }
private JPanel makePathAttributesPanel() { JPanel outerPanel = new JPanel(new BorderLayout(6, 6)); outerPanel.setBorder(this.createTitleBorder("Path Attributes")); GridLayout nameLayout = new GridLayout(0, 1, 6, 6); JPanel namePanel = new JPanel(nameLayout); GridLayout valueLayout = new GridLayout(0, 1, 6, 6); JPanel valuePanel = new JPanel(valueLayout); namePanel.add(new JLabel("Follow Terrain")); JCheckBox ckb = new JCheckBox(); ckb.setSelected(currentFollowTerrain); ckb.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentFollowTerrain = ((JCheckBox) actionEvent.getSource()).isSelected(); update(); } }); valuePanel.add(ckb); JLabel label; namePanel.add(label = new JLabel("Conformance")); int[] values = new int[] {1, 2, 4, 8, 10, 15, 20, 30, 40, 50}; String[] strings = new String[values.length]; for (int i = 0; i < values.length; i++) { strings[i] = Integer.toString(values[i]) + " pixels"; } JSpinner sp = new JSpinner(new SpinnerListModel(strings)); onTerrainOnlyItems.add(label); onTerrainOnlyItems.add(sp); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { String v = (String) ((JSpinner) changeEvent.getSource()).getValue(); currentTerrainConformance = Integer.parseInt(v.substring(0, v.indexOf(" "))); update(); } }); sp.setValue(Integer.toString(currentTerrainConformance) + " pixels"); valuePanel.add(sp); namePanel.add(label = new JLabel("Subsegments")); sp = new JSpinner(new SpinnerListModel(new String[] {"1", "2", "5", "10", "20", "40", "50"})); offTerrainOnlyItems.add(label); offTerrainOnlyItems.add(sp); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { String v = (String) ((JSpinner) changeEvent.getSource()).getValue(); currentNumSubsegments = Integer.parseInt(v); update(); } }); sp.setValue(Integer.toString(currentNumSubsegments)); valuePanel.add(sp); namePanel.add(new JLabel("Type")); final JComboBox cb = new JComboBox(new String[] {"Great Circle", "Linear", "Rhumb Line"}); cb.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentPathType = (String) cb.getSelectedItem(); update(); } }); cb.setSelectedItem("Great Circle"); valuePanel.add(cb); namePanel.add(new JLabel("Style")); final JComboBox cb1 = new JComboBox(new String[] {"None", "Solid", "Dash"}); cb1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentPathStyle = (String) cb1.getSelectedItem(); update(); } }); cb1.setSelectedItem("Solid"); valuePanel.add(cb1); namePanel.add(new JLabel("Width")); sp = new JSpinner(new SpinnerNumberModel(this.currentPathWidth, 1d, 10d, 1d)); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { currentPathWidth = (Double) ((JSpinner) changeEvent.getSource()).getValue(); update(); } }); sp.setValue(currentPathWidth); valuePanel.add(sp); namePanel.add(new JLabel("Color")); JComboBox cb2 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"}); cb2.setSelectedItem(currentPathColor); cb2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { currentPathColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem(); update(); } }); valuePanel.add(cb2); namePanel.add(new JLabel("Opacity")); sp = new JSpinner(new SpinnerNumberModel(this.currentPathOpacity, 0, 10, 1)); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { currentPathOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue(); update(); } }); valuePanel.add(sp); namePanel.add(new JLabel("Offset")); sp = new JSpinner( new SpinnerListModel( new String[] {"0", "10", "100", "1000", "10000", "100000", "1000000"})); sp.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { currentOffset = Float.parseFloat((String) ((JSpinner) changeEvent.getSource()).getValue()); update(); } }); sp.setValue("0"); valuePanel.add(sp); outerPanel.add(namePanel, BorderLayout.WEST); outerPanel.add(valuePanel, BorderLayout.CENTER); return outerPanel; }