List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel
public DefaultComboBoxModel()
From source file:gtu._work.ui.ObnfExceptionLogDownloadUI.java
private void initGUI() { try {//w ww.j ava 2 s. c om JCommonUtil.frameCloseConfirm(this); BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); FlowLayout jPanel1Layout = new FlowLayout(); jTabbedPane1.addTab("", null, jPanel1, null); jPanel1.setLayout(jPanel1Layout); { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("\u532f\u51fa\u76ee\u9304"); } { exportTextField = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(exportTextField, true); jPanel1.add(exportTextField); exportTextField.setPreferredSize(new java.awt.Dimension(187, 22)); } { jLabel2 = new JLabel(); jPanel1.add(jLabel2); jLabel2.setText("domainJar"); jLabel2.setPreferredSize(new java.awt.Dimension(56, 15)); } { domainJarText = new JTextField(); ObnfRepairDBBatch batch = new ObnfRepairDBBatch(); domainJarText.setText(batch.fetchDomainJar()); JCommonUtil.jTextFieldSetFilePathMouseEvent(domainJarText, false); jPanel1.add(domainJarText); domainJarText.setPreferredSize(new java.awt.Dimension(185, 22)); } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1); jScrollPane1.setPreferredSize(new java.awt.Dimension(512, 262)); { messageIdArea = new JTextArea(); jScrollPane1.setViewportView(messageIdArea); } } { DefaultComboBoxModel jComboBox1Model = new DefaultComboBoxModel(); for (FtpSite f : FtpSite.values()) { jComboBox1Model.addElement(f); } siteFtpComboBox = new JComboBox(); jPanel1.add(siteFtpComboBox); siteFtpComboBox.setModel(jComboBox1Model); } { downloadBtn = new JButton(); jPanel1.add(downloadBtn); downloadBtn.setText("\u4e0b\u8f09"); downloadBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { downloadBtnAction(); } }); } { makeReportBtn = new JButton(); jPanel1.add(makeReportBtn); makeReportBtn.setText("\u7522\u751f\u5831\u8868"); makeReportBtn.setPreferredSize(new java.awt.Dimension(102, 22)); makeReportBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { makeReportBtnPerformed(); } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("log", null, jPanel2, null); { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(529, 340)); { logArea = new JTextArea(); jScrollPane2.setViewportView(logArea); } } } } pack(); this.setSize(542, 394); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:net.sf.maltcms.chromaui.foldChangeViewer.ui.FoldChangeViewTopComponent.java
public void initialize(final IChromAUIProject project, final ADataset1D<StatisticsContainer, FoldChangeElement> ds) { if (initialized.compareAndSet(false, true)) { final ProgressHandle handle = ProgressHandleFactory.createHandle("Loading chart"); final JComponent progressComponent = ProgressHandleFactory.createProgressComponent(handle); final JPanel box = new JPanel(); box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); box.add(Box.createHorizontalGlue()); box.add(progressComponent);//from w w w . j a v a 2 s .co m box.add(Box.createHorizontalGlue()); add(box, BorderLayout.CENTER); AProgressAwareRunnable runnable = new AProgressAwareRunnable() { @Override public void run() { try { handle.start(); handle.progress("Initializing Overlays..."); if (project != null) { ic.add(project); } dataset = ds; annotations = new ArrayList<XYAnnotation>(0); final DefaultComboBoxModel dcbm = new DefaultComboBoxModel(); ic.add(ds); for (int i = 0; i < ds.getSeriesCount(); i++) { ic.add(ds.getSource(i)); } handle.progress("Initializing Settings and Properties..."); ic.add(new Properties()); sp = new SettingsPanel(); ic.add(sp); handle.progress("Creating panel..."); jp = new FoldChangeViewPanel(ic, getLookup(), ds); ic.add(jp); ic.add(this); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { //EDT stuff setDisplayName("Fold change view of " + ds.getDisplayName()); setToolTipText(ds.getDescription()); remove(box); add(jp, BorderLayout.CENTER); load(); } }); } finally { handle.finish(); } } }; runnable.setProgressHandle(handle); AProgressAwareRunnable.createAndRun("Creating chart", runnable); } }
From source file:net.sf.jasperreports.swing.JRViewerToolbar.java
private void initComponents() { btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); pnlSep01 = new javax.swing.JPanel(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); pnlSep02 = new javax.swing.JPanel(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); pnlSep03 = new javax.swing.JPanel(); btnZoomIn = new javax.swing.JButton(); btnZoomOut = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); }/*from www . j av a2 s . c o m*/ cmbZoom.setModel(model); setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnSave.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); btnSave.setToolTipText(viewerContext.getBundleString("save")); btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnSave.setMaximumSize(new java.awt.Dimension(23, 23)); btnSave.setMinimumSize(new java.awt.Dimension(23, 23)); btnSave.setPreferredSize(new java.awt.Dimension(23, 23)); btnSave.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); btnPrint.setToolTipText(viewerContext.getBundleString("print")); btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrint.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrint.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrint.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrint.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); add(btnPrint); btnReload.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/reload.GIF"))); btnReload.setToolTipText(viewerContext.getBundleString("reload")); btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnReload.setMaximumSize(new java.awt.Dimension(23, 23)); btnReload.setMinimumSize(new java.awt.Dimension(23, 23)); btnReload.setPreferredSize(new java.awt.Dimension(23, 23)); btnReload.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); add(btnReload); pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); btnFirst.setToolTipText(viewerContext.getBundleString("first.page")); btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFirst.setMaximumSize(new java.awt.Dimension(23, 23)); btnFirst.setMinimumSize(new java.awt.Dimension(23, 23)); btnFirst.setPreferredSize(new java.awt.Dimension(23, 23)); btnFirst.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); btnPrevious.setToolTipText(viewerContext.getBundleString("previous.page")); btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrevious.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); btnNext.setToolTipText(viewerContext.getBundleString("next.page")); btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setMaximumSize(new java.awt.Dimension(23, 23)); btnNext.setMinimumSize(new java.awt.Dimension(23, 23)); btnNext.setPreferredSize(new java.awt.Dimension(23, 23)); btnNext.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); btnLast.setToolTipText(viewerContext.getBundleString("last.page")); btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnLast.setMaximumSize(new java.awt.Dimension(23, 23)); btnLast.setMinimumSize(new java.awt.Dimension(23, 23)); btnLast.setPreferredSize(new java.awt.Dimension(23, 23)); btnLast.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); add(btnLast); txtGoTo.setToolTipText(viewerContext.getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); btnActualSize.setToolTipText(viewerContext.getBundleString("actual.size")); btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23)); btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23)); btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23)); btnActualSize.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); btnFitPage.setToolTipText(viewerContext.getBundleString("fit.page")); btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitPage.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); btnFitWidth.setToolTipText(viewerContext.getBundleString("fit.width")); btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); btnZoomIn.setToolTipText(viewerContext.getBundleString("zoom.in")); btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); btnZoomOut.setToolTipText(viewerContext.getBundleString("zoom.out")); btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(viewerContext.getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { @Override public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); add(cmbZoom); }
From source file:co.com.soinsoftware.hotelero.view.JFRoomService.java
private void setServiceModel(final ServiceType serviceType) { this.serviceList = this.serviceController.selectByServiceType(serviceType); final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); model.addElement("Seleccione uno..."); for (final Service service : this.serviceList) { if (service.isEnabled()) { model.addElement(service.getName()); }/*from w w w . java 2 s . c o m*/ } this.jcbService.setModel(model); }
From source file:de.huxhorn.lilith.swing.preferences.PreferencesDialog.java
private void createUI() { generalPanel = new GeneralPanel(this); startupShutdownPanel = new StartupShutdownPanel(this); windowsPanel = new WindowsPanel(this); soundsPanel = new SoundsPanel(this); sourcesPanel = new SourcesPanel(this); sourceListsPanel = new SourceListsPanel(this); sourceFilteringPanel = new SourceFilteringPanel(this); conditionsPanel = new ConditionsPanel(this); loggingLevelPanel = new LoggingLevelPanel(this); accessStatusTypePanel = new AccessStatusTypePanel(this); TroubleshootingPanel troubleshootingPanel = new TroubleshootingPanel(this); comboBoxModel = new DefaultComboBoxModel<>(); for (Panes current : Panes.values()) { comboBoxModel.addElement(current); }/*from w w w. ja va 2s .c o m*/ comboBox = new JComboBox<>(comboBoxModel); comboBox.setRenderer(new MyComboBoxRenderer()); comboBox.setEditable(false); comboBox.addItemListener(new ComboItemListener()); cardLayout = new CardLayout(); content = new JPanel(cardLayout); content.setPreferredSize(new Dimension(600, 500)); content.add(generalPanel, Panes.General.toString()); content.add(startupShutdownPanel, Panes.StartupShutdown.toString()); content.add(windowsPanel, Panes.Windows.toString()); content.add(soundsPanel, Panes.Sounds.toString()); content.add(sourcesPanel, Panes.Sources.toString()); content.add(sourceListsPanel, Panes.SourceLists.toString()); content.add(sourceFilteringPanel, Panes.SourceFiltering.toString()); content.add(conditionsPanel, Panes.Conditions.toString()); content.add(loggingLevelPanel, Panes.LoggingLevels.toString()); content.add(accessStatusTypePanel, Panes.AccessStatus.toString()); content.add(troubleshootingPanel, Panes.Troubleshooting.toString()); // Main buttons JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); OkAction okAction = new OkAction(); buttonPanel.add(new JButton(okAction)); buttonPanel.add(new JButton(new ApplyAction())); buttonPanel.add(new JButton(new ResetAction())); CancelAction cancelAction = new CancelAction(); buttonPanel.add(new JButton(cancelAction)); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(comboBox, BorderLayout.NORTH); contentPane.add(content, BorderLayout.CENTER); contentPane.add(buttonPanel, BorderLayout.SOUTH); KeyStrokes.registerCommand(content, okAction, "OK_ACTION"); KeyStrokes.registerCommand(buttonPanel, okAction, "OK_ACTION"); KeyStrokes.registerCommand(content, cancelAction, "CANCEL_ACTION"); KeyStrokes.registerCommand(buttonPanel, cancelAction, "CANCEL_ACTION"); }
From source file:io.github.jeddict.jpa.modeler.properties.named.nativequery.NamedNativeQueryPanel.java
private void initResultClassesModel() { resultClass_jComboBox.removeAllItems(); DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(null);/* w w w .j a va 2 s . c om*/ entityMappings.getEntity().forEach(entity -> model.addElement(entity.getClazz())); resultClass_jComboBox.setModel(model); }
From source file:hermes.browser.dialog.EditNamingConfigDialog.java
private ComboBoxModel createComboBoxModel() { DefaultComboBoxModel model = new DefaultComboBoxModel(); if (newConfig != null) { model.addElement(newConfig.getId()); }//from ww w. ja va 2s .co m for (Iterator iter = namingConfigs.iterator(); iter.hasNext();) { NamingConfig config = (NamingConfig) iter.next(); namingConfigsByName.put(config.getId(), config); model.addElement(config.getId()); if (selectedConfig == null) { selectedConfig = config.getId(); } } return model; }
From source file:io.github.jeddict.jpa.modeler.properties.named.nativequery.NamedNativeQueryPanel.java
private void initResultSetMappingModel() { resultSetMapping_jComboBox.removeAllItems(); DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(null);//from ww w. j a v a 2s . co m entity.getSqlResultSetMapping().forEach(mapping -> model.addElement(mapping.getName())); resultSetMapping_jComboBox.setModel(model); }
From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java
private void addProblems() { problemComboBox.setModel(new DefaultComboBoxModel()); problemComboBox.addItem(""); for (Class<? extends Problem> problem : applicationContext.getProblemList()) { try {/*from w w w. j a va 2 s . c om*/ problemComboBox.addItem(problem.getConstructors()[0].newInstance()); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:co.com.soinsoftware.hotelero.view.JFRoom.java
public void setCompanyModel() { this.companyList = this.companyController.select(); final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); model.addElement("Ninguna"); for (final Company company : this.companyList) { model.addElement(company.getName()); }/* www . j ava2s . co m*/ this.jcbCompany.setModel(model); }