List of usage examples for javax.swing DefaultComboBoxModel addElement
public void addElement(E anObject)
From source file:com.alvermont.terraj.planet.ui.MainFrame.java
/** * Set up our list model from the projection list */// ww w . ja v a2s.c o m protected void setListModel() { final DefaultComboBoxModel<Projector> dcm = new DefaultComboBoxModel<>(); for (Projector p : projManager.getProjections()) { dcm.addElement(p); } projComboBox.setModel(dcm); // make the first one selected dcm.setSelectedItem(dcm.getElementAt(0)); // TODO: do this properly projComboBoxActionPerformed(new ActionEvent(this, 0, "Hack")); }
From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java
/** * /* ww w. ja v a 2s . c o m*/ */ public void buildUI() { setIgnoreChanges(true); fieldsList = createList(fieldsModel); fieldsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { getAllDataFromUI(); fieldSelected(); } } }); fieldsList.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { super.focusLost(e); //lastIndex = fieldsList.getSelectedIndex(); } }); fieldDescText.addKeyListener(new LengthWatcher(255)); // setting min and pref sizes to some bogus values so that textarea shrinks with dialog fieldNameText.addKeyListener(new LengthWatcher(64)); CellConstraints cc = new CellConstraints(); int y = 1; JScrollPane fldsp = UIHelper.createScrollPane(fieldsList); // LocalizableNameDescIFace PanelBuilder pb = new PanelBuilder(new FormLayout("max(200px;p),4px,p,2px,p,10px,p,2px,p,f:p:g", (includeHiddenUI ? "p,2px," : "") + (isDBSchema ? "p,2px,p,2px," : "") + (includeFormatAndAutoNumUI ? "p,2px,p,2px," : "") + "p,2px,p,2px,p,2px,p,2px,p,2px,p,2px,f:p:g"), this); pb.add(fldsp, cc.xywh(1, y, 1, 7 + (isDBSchema ? 4 : 0))); pb.add(fieldNameLbl = createI18NFormLabel("SL_LABEL", SwingConstants.RIGHT), cc.xy(3, y)); pb.add(fieldNameText, cc.xywh(5, y, 6, 1)); y += 2; if (includeHiddenUI) { pb.add(fieldHideChk, cc.xy(5, y)); y += 2; } pb.add(fieldDescLbl = createI18NFormLabel("SL_DESC", SwingConstants.RIGHT), cc.xy(3, y)); JScrollPane sp = new JScrollPane(fieldDescText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); pb.add(sp, cc.xywh(5, y, 6, 1)); y += 2; fieldDescText.setLineWrap(true); fieldDescText.setWrapStyleWord(true); if (isDBSchema) { fieldTypeTxt = createLabel(""); fieldLengthTxt = createLabel(""); pb.add(fieldTypeLbl = createI18NFormLabel("SL_TYPE", SwingConstants.RIGHT), cc.xy(3, y)); pb.add(fieldTypeTxt, cc.xy(5, y)); pb.add(fieldReqChk = createCheckBox(getResourceString("SL_REQ")), cc.xy(9, y)); y += 2; pb.add(fieldLengthLbl = createI18NFormLabel("SL_LENGTH", SwingConstants.RIGHT), cc.xy(3, y)); pb.add(fieldLengthTxt, cc.xy(5, y)); y += 2; fieldTypeTxt.setBackground(Color.WHITE); fieldLengthTxt.setBackground(Color.WHITE); fieldTypeTxt.setOpaque(true); fieldLengthTxt.setOpaque(true); } if (includeFormatAndAutoNumUI) { PanelBuilder inner = new PanelBuilder(new FormLayout("p,2px,p", "p")); formatSwitcherCombo = createComboBox(); fmtCardLayout = new CardLayout(); formatterPanel = new JPanel(fmtCardLayout); pb.add(formatLbl = createI18NFormLabel("SL_FMTTYPE", SwingConstants.RIGHT), cc.xy(3, y)); inner.add(formatSwitcherCombo, cc.xy(1, 1)); inner.add(formatterPanel, cc.xy(3, 1)); pb.add(inner.getPanel(), cc.xywh(5, y, 6, 1)); y += 2; ActionListener switchAL = new ActionListener() { public void actionPerformed(ActionEvent e) { String item = (String) formatSwitcherCombo.getSelectedItem(); if (item != null) { fmtCardLayout.show(formatterPanel, item); webLinkCombo.setEnabled(item.equals(SL_WEBLINK)); if (formatSwitcherCombo.getSelectedIndex() == 0) { if (webLinkCombo.getModel().getSize() > 0) { webLinkCombo.setSelectedIndex(0); } if (formatCombo.getModel().getSize() > 0) { formatCombo.setSelectedIndex(0); } if (pickListCBX.getModel().getSize() > 0) { pickListCBX.setSelectedIndex(0); } } } } }; formatSwitcherCombo.addActionListener(switchAL); formatterPanel.add(SL_NONE, new JPanel()); //-------------------------- // UIFieldFormatter //-------------------------- inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p")); formatCombo = createComboBox(new DefaultComboBoxModel()); formatMoreBtn = createButton(ELIPSES); inner.add(formatCombo, cc.xy(1, 1)); inner.add(formatMoreBtn, cc.xy(3, 1)); formatMoreBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UIFormatterListEdtDlg dlg = new UIFormatterListEdtDlg((Frame) UIRegistry.getTopWindow(), fieldInfo, true, schemaPanel.getUiFieldFormatterMgrCache()); dlg.setVisible(true); if (!dlg.isCancelled() && dlg.hasChanged()) { //schemaPanel.setHasChanged(true); formHasChanged(); //fillFormatBox(dlg.getSelectedFormat()); setSelectedFieldFormatter(dlg.getSelectedFormat()); } } }); formatterPanel.add(SL_FORMAT, inner.getPanel()); ActionListener changed = new ActionListener() { public void actionPerformed(ActionEvent e) { formHasChanged(); boolean hasFormat = formatCombo.getSelectedIndex() > 0; webLinkCombo.setEnabled(!hasFormat); if (hasFormat) { webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1); pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1); } } }; formatCombo.addActionListener(changed); //-------------------------- // WebLinks //-------------------------- webLinkMoreBtn = createButton(ELIPSES); webLinkMoreBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { WebLinkDef selectedWL = (WebLinkDef) webLinkCombo.getSelectedItem(); WebLinkConfigDlg dlg = webLinkMgrCache.editWebLinks(tableInfo, false); if (dlg.getBtnPressed() == CustomDialog.OK_BTN) { fillWebLinkBox(); formHasChanged(); if (selectedWL != null && !selectedWL.getName().equals(SL_WEBLINK)) { dlg.setWebLink(selectedWL.getName()); } if (dlg.getBtnPressed() == CustomDialog.OK_BTN) { setSelectedWebLink(dlg.getSelectedItem()); } } } }); inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p")); webLinkCombo = createComboBox(); DefaultComboBoxModel model = (DefaultComboBoxModel) webLinkCombo.getModel(); model.addElement(webLinkDefNone); webLinkCombo.setSelectedIndex(0); inner.add(webLinkCombo, cc.xy(1, 1)); inner.add(webLinkMoreBtn, cc.xy(3, 1)); ActionListener wlchanged = new ActionListener() { public void actionPerformed(ActionEvent e) { formHasChanged(); boolean hasWL = webLinkCombo.getSelectedIndex() > 0; webLinkCombo.setEnabled(hasWL); if (hasWL) { formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1); pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1); } } }; webLinkCombo.addActionListener(wlchanged); formatterPanel.add(SL_WEBLINK, inner.getPanel()); } //-------------------------- // PickList //-------------------------- pickListCBX = createComboBox(new DefaultComboBoxModel()); pickListCBX.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { formHasChanged(); if (formatCombo != null && pickListCBX.getSelectedIndex() > 0) { formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1); webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1); } } }); pickListMoreBtn = createButton(ELIPSES); pickListMoreBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { LocalizableItemIFace currentField = prevField; prevField = getSelectedFieldItem(); PickList selectedItem = (PickList) pickListCBX.getSelectedItem(); PickListEditorDlg dlg = new PickListEditorDlg( localizableIO.hasUpdatablePickLists() ? null : localizableIO, true, true); dlg.setTableInfo(tableInfo); dlg.setFieldInfo(fieldInfo); dlg.createUI(); dlg.setSize(400, 500); dlg.setVisible(true); if (!dlg.isCancelled()) { if (dlg.hasChanged()) { hasChanged = true; Vector<PickList> list = dlg.getNewPickLists(); DefaultComboBoxModel plCbxModel = (DefaultComboBoxModel) pickListCBX.getModel(); for (int i = 0; i < plCbxModel.getSize(); i++) { list.add((PickList) plCbxModel.getElementAt(i)); } Collections.sort(list); plCbxModel.removeAllElements(); plCbxModel.addElement(pickListNone); int inx = -1; int i = 0; for (PickList pl : list) { plCbxModel.addElement(pl); if (inx == -1 && selectedItem != null && ((selectedItem.getId() != null && pl.getId() != null && selectedItem.getId().equals(pl.getId())) || (selectedItem.getName() != null && pl.getName() != null && selectedItem.getName().equals(pl.getName())))) { inx = i; } i++; } pickListCBX.setSelectedIndex(inx + 1); } } prevField = currentField; } }); if (includeFormatAndAutoNumUI) { PanelBuilder inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p")); inner.add(pickListCBX, cc.xy(1, 1)); inner.add(pickListMoreBtn, cc.xy(3, 1)); formatterPanel.add(SL_PICKLIST, inner.getPanel()); } else { pb.add(pickListLbl = createI18NFormLabel(SL_PICKLIST, SwingConstants.RIGHT), cc.xy(3, y)); pb.add(pickListCBX, cc.xy(5, y)); pb.add(pickListMoreBtn, cc.xy(7, y)); y += 2; } nxtBtn = createI18NButton("SL_NEXT"); nxtEmptyBtn = createI18NButton("SL_NEXT_EMPTY"); fldSpellChkBtn = createI18NButton("SL_SPELL_CHECK"); //JPanel bbp = ButtonBarFactory.buildCenteredBar(adjustButtonArray(new JButton[] {nxtEmptyBtn, nxtBtn, fldSpellChkBtn})); //bbp.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); //pb.add(bbp, cc.xywh(3, y, 8, 1)); nxtBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { next(); } }); nxtEmptyBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { nextEmpty(); } }); fldSpellChkBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (checker != null) { checker.spellCheck(fieldDescText); checker.spellCheck(fieldNameText); } } }); fieldHideChk.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { formHasChanged(); } }); fieldReqChk.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { formHasChanged(); } }); DocumentListener dl = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { formHasChanged(); } }; fieldNameText.getDocument().addDocumentListener(dl); fieldDescText.getDocument().addDocumentListener(dl); /* if (formatTxt != null) { formatTxt.getDocument().addDocumentListener(dl); } */ SchemaI18NService.getInstance().checkCurrentLocaleMenu(); enableUIControls(false); setIgnoreChanges(false); }
From source file:gdt.jgui.entity.query.JQueryPanel.java
private void initElementSelector() { DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); String[] sa = select();// w ww. j a v a2s .c om if (sa == null) { elementComboBox.setModel(model); return; } try { Entigrator entigrator = console.getEntigrator(entihome$); ArrayList<String> sl = new ArrayList<String>(); Sack entity; String[] ea; for (String s : sa) { entity = entigrator.getEntityAtKey(s); if (entity == null) continue; ea = entity.elementsList(); if (ea != null) for (String e : ea) if (!sl.contains(e)) sl.add(e); } Collections.sort(sl); for (String s : sl) model.addElement(s); elementComboBox.setModel(model); } catch (Exception e) { Logger.getLogger(getClass().getName()).severe(e.toString()); } }
From source file:gtu._work.ui.DirectoryCompareUI.java
/** * TODO/*www . j av a2 s . co m*/ */ private void compareStart() { try { String leftStr = leftDirText.getText(); String rightStr = rightDirText.getText(); Validate.notBlank(leftStr, "??"); Validate.notBlank(rightStr, "???"); initComponents(); File leftFile = new File(StringUtils.trim(leftStr)); File rightFile = new File(StringUtils.trim(rightStr)); if (!leftFile.exists()) { leftFile = File.createTempFile("left_", ".txt"); if (leftFile.exists()) { leftFile.delete(); } FileUtils.write(leftFile, leftStr, "utf8"); } if (!rightFile.exists()) { rightFile = File.createTempFile("right_", ".txt"); if (rightFile.exists()) { rightFile.delete(); } FileUtils.write(rightFile, rightStr, "utf8"); } File mainFile = leftFile; File compareFile = rightFile; modelOrignList.clear(); compareSearch = new MainCompareSearch(mainFile, compareFile) { @Override void compareFileNotExists(FileZ mainFile, FileZ compareToFile, boolean mainFileIsLeft) { modelOrignList .add(getCreateRow(mainFile, compareToFile, mainFileIsLeft, DiffMergeStatus.NOT_EXISTS)); } @Override void sameFile(FileZ mainFile, FileZ compareToFile, boolean mainFileIsLeft) { modelOrignList.add(getCreateRow(mainFile, compareToFile, mainFileIsLeft, DiffMergeStatus.SAME)); } @Override void differentFile(FileZ mainFile, FileZ compareToFile, boolean mainFileIsLeft) { modelOrignList .add(getCreateRow(mainFile, compareToFile, mainFileIsLeft, DiffMergeStatus.DIFFERENT)); } @Override void complete() { DefaultTableModel dirCompareModel = getDefaultTableModel(); DefaultComboBoxModel extensionModel = new DefaultComboBoxModel(); Set<String> extensionSet = new TreeSet<String>(); for (Object[] rows : modelOrignList) { dirCompareModel.addRow(rows); InfoObj infoObj = (InfoObj) rows[0]; // ??? checkExtensionName(infoObj, extensionSet); } extensionModel.addElement(EXTENSION_ALL); extensionModel.addElement(EXTENSION_CUSTOM); for (String name : extensionSet) { extensionModel.addElement(name); } while (extensionNameComboBox.getModel().getSize() != extensionModel.getSize()) { extensionNameComboBox.setModel(extensionModel); System.out.println("reset extensionNameComboBox"); } while (dirCompareTable.getModel().getRowCount() != dirCompareModel.getRowCount()) { dirCompareTable.setModel(dirCompareModel); System.out.println("reset dirCompareTable"); } System.out.println( "extensionNameComboBox = " + (extensionNameComboBox.getModel() == extensionModel)); System.out.println("dirCompareTable = " + (dirCompareTable.getModel() == dirCompareModel)); System.out.println("extensionNameComboBox = " + extensionNameComboBox.getModel().getSize()); System.out.println("dirCompareTable = " + dirCompareTable.getModel().getRowCount()); setTitle(":" + mainFileCount + "/?:" + compareToFileCount + ", :" + completeTime); JCommonUtil._jOptionPane_showMessageDialog_info(// "???" + // "\n?:" + this.countSameFile + // "\n??:" + this.countDifferentFile + // "\n?:" + this.countNotExists + // "\n:" + completeTime + // "\n?merge:" + modelOrignList.size()); } }; if (leftFile.isDirectory() && rightFile.isDirectory()) { if (StringUtils.equals(FINDFUNCTION_ABS, String.valueOf(compareStyleComboBox.getSelectedItem()))) { compareSearch.executeSameDirectory(); } else if (StringUtils.equals(FINDFUNCTION_REL, String.valueOf(compareStyleComboBox.getSelectedItem()))) { List<File> mainFileList = new ArrayList<File>(); List<File> compareFileList = new ArrayList<File>(); FileUtil.searchFilefind(mainFile, ".*", mainFileList); FileUtil.searchFilefind(compareFile, ".*", compareFileList); compareSearch.executeTwoDirectoryButNotSame(mainFileList, compareFileList); } else { Validate.isTrue(false, "??!"); } } else if (leftFile.isFile() && rightFile.isFile()) { compareSearch.executeTwoFile(); } else if (leftFile.isDirectory() && rightFile.isFile()) { List<File> mainFileList = new ArrayList<File>(); List<File> compareFileList = new ArrayList<File>(); FileUtil.searchFilefind(mainFile, ".*", mainFileList); compareFileList.add(compareFile); compareSearch.executeTwoDirectoryButNotSame(mainFileList, compareFileList); compareStyleComboBox.setSelectedItem(FINDFUNCTION_REL); } else if (leftFile.isFile() && rightFile.isDirectory()) { List<File> mainFileList = new ArrayList<File>(); List<File> compareFileList = new ArrayList<File>(); mainFileList.add(mainFile); FileUtil.searchFilefind(compareFile, ".*", compareFileList); compareSearch.executeTwoDirectoryButNotSame(mainFileList, compareFileList); compareStyleComboBox.setSelectedItem(FINDFUNCTION_REL); } else { Validate.isTrue(false, "???!"); } } catch (Exception ex) { JCommonUtil.handleException(ex, false); } }
From source file:com.openbravo.pos.util.JRViewer411.java
/** This method is called from within the constructor to * initialize the form./*w w w. j a v a 2 s . c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); jToolBar = new javax.swing.JToolBar(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); jSeparator2 = new javax.swing.JToolBar.Separator(); btnZoomIn = 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] + "%"); } cmbZoom.setModel(model); btnZoomOut = new javax.swing.JButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); jSeparator4 = new javax.swing.JToolBar.Separator(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); jToolBar.setFloatable(false); jToolBar.setOpaque(false); btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/filesave.png"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); jToolBar.add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/yast_printer.png"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); jToolBar.add(btnPrint); btnReload.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/reload.png"))); // NOI18N btnReload.setToolTipText(getBundleString("reload")); btnReload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); jToolBar.add(btnReload); jToolBar.add(jSeparator1); btnActualSize.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime.png"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); jToolBar.add(btnActualSize); btnFitPage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime2.png"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); jToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime3.png"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); jToolBar.add(btnFitWidth); jToolBar.add(jSeparator2); btnZoomIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag+.png"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); jToolBar.add(btnZoomIn); cmbZoom.setEditable(true); cmbZoom.setToolTipText(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.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); jToolBar.add(cmbZoom); btnZoomOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag-.png"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); jToolBar.add(btnZoomOut); jToolBar.add(jSeparator3); btnFirst.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/2leftarrow.png"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); jToolBar.add(btnFirst); btnPrevious .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1leftarrow.png"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); jToolBar.add(btnPrevious); txtGoTo.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); jToolBar.add(txtGoTo); btnNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1rightarrow.png"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); jToolBar.add(btnNext); btnLast.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/2rightarrow.png"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); jToolBar.add(btnLast); jToolBar.add(jSeparator4); lblStatus.setText("Page i of n"); jToolBar.add(lblStatus); pnlMain.add(jToolBar, java.awt.BorderLayout.NORTH); add(pnlMain, java.awt.BorderLayout.CENTER); }
From source file:com.openbravo.pos.util.JRViewer.java
/** This method is called from within the constructor to * initialize the form./*from w w w .j a v a 2 s. c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); jToolBar = new javax.swing.JToolBar(); btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); jSeparator2 = new javax.swing.JToolBar.Separator(); btnZoomIn = 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] + "%"); } cmbZoom.setModel(model); btnZoomOut = new javax.swing.JButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); jSeparator4 = new javax.swing.JToolBar.Separator(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); jToolBar.setFloatable(false); jToolBar.setOpaque(false); btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/filesave.png"))); // NOI18N btnSave.setToolTipText(getBundleString("save")); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); jToolBar.add(btnSave); btnPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/printer.png"))); // NOI18N btnPrint.setToolTipText(getBundleString("print")); btnPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); jToolBar.add(btnPrint); btnReload.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/reload.png"))); // NOI18N btnReload.setToolTipText(getBundleString("reload")); btnReload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); jToolBar.add(btnReload); jToolBar.add(jSeparator1); btnActualSize.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime.png"))); // NOI18N btnActualSize.setToolTipText(getBundleString("actual.size")); btnActualSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); jToolBar.add(btnActualSize); btnFitPage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime2.png"))); // NOI18N btnFitPage.setToolTipText(getBundleString("fit.page")); btnFitPage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); jToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/mime3.png"))); // NOI18N btnFitWidth.setToolTipText(getBundleString("fit.width")); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); jToolBar.add(btnFitWidth); jToolBar.add(jSeparator2); btnZoomIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag+.png"))); // NOI18N btnZoomIn.setToolTipText(getBundleString("zoom.in")); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); jToolBar.add(btnZoomIn); cmbZoom.setEditable(true); cmbZoom.setToolTipText(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.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); cmbZoom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); jToolBar.add(cmbZoom); btnZoomOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/viewmag-.png"))); // NOI18N btnZoomOut.setToolTipText(getBundleString("zoom.out")); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); jToolBar.add(btnZoomOut); jToolBar.add(jSeparator3); btnFirst.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/2leftarrow.png"))); // NOI18N btnFirst.setToolTipText(getBundleString("first.page")); btnFirst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); jToolBar.add(btnFirst); btnPrevious .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1leftarrow.png"))); // NOI18N btnPrevious.setToolTipText(getBundleString("previous.page")); btnPrevious.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); jToolBar.add(btnPrevious); txtGoTo.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); jToolBar.add(txtGoTo); btnNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/1rightarrow.png"))); // NOI18N btnNext.setToolTipText(getBundleString("next.page")); btnNext.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); jToolBar.add(btnNext); btnLast.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/2rightarrow.png"))); // NOI18N btnLast.setToolTipText(getBundleString("last.page")); btnLast.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); jToolBar.add(btnLast); jToolBar.add(jSeparator4); lblStatus.setText("Page i of n"); jToolBar.add(lblStatus); pnlMain.add(jToolBar, java.awt.BorderLayout.NORTH); add(pnlMain, java.awt.BorderLayout.CENTER); }
From source file:ehospital.Principal.java
private void jMenuItem_eliminar_ambulanciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_eliminar_ambulanciaActionPerformed // TODO add your handling code here: DefaultComboBoxModel modelo = new DefaultComboBoxModel(); for (int i = 0; i < lista_ambu.size(); i++) { modelo.addElement(lista_ambu.get(i).getPlaca()); }/*www . j a v a 2s. c om*/ cb_ambu_eliminar.setModel(modelo); jd_ambu_eliminar.setModal(true); jd_ambu_eliminar.pack(); jd_ambu_eliminar.setVisible(true); }
From source file:ehospital.Principal.java
private void jMenuItem_eliminar_hospitalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem_eliminar_hospitalActionPerformed // TODO add your handling code here: DefaultComboBoxModel modelo = new DefaultComboBoxModel(); for (int i = 0; i < lista_lugares.size(); i++) { modelo.addElement(lista_lugares.get(i).getNombre()); }/*from www. j a v a 2 s. c om*/ cb_hospital_eliminar.setModel(modelo); jd_hospital_lugar_eliminar.setModal(true); jd_hospital_lugar_eliminar.pack(); jd_hospital_lugar_eliminar.setVisible(true); }
From source file:neg.JRViewerSin.java
/** This method is called from within the constructor to * initialize the form.//from w ww.ja v a 2 s . c om * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; tlbToolBar = new javax.swing.JPanel(); 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] + "%"); } cmbZoom.setModel(model); pnlSep3 = new javax.swing.JPanel(); pnlSep4 = new javax.swing.JPanel(); pnlSep5 = new javax.swing.JPanel(); pnlSep6 = new javax.swing.JPanel(); pnlSep7 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); pnlMain = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(this); pnlStatus = new javax.swing.JPanel(); lblStatus = new javax.swing.JLabel(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); tlbToolBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); // NOI18N btnPrint.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); tlbToolBar.add(btnPrint); btnReload.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/reload.GIF"))); // NOI18N btnReload.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); tlbToolBar.add(btnReload); pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); // NOI18N btnFirst.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); tlbToolBar.add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); // NOI18N btnPrevious.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); tlbToolBar.add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); // NOI18N btnNext.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); tlbToolBar.add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); // NOI18N btnLast.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); tlbToolBar.add(btnLast); txtGoTo.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); tlbToolBar.add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); // NOI18N btnActualSize.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); tlbToolBar.add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); // NOI18N btnFitPage.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); tlbToolBar.add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); // NOI18N btnFitWidth.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); tlbToolBar.add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); // NOI18N btnZoomIn.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); tlbToolBar.add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); // NOI18N btnZoomOut.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); tlbToolBar.add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(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() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); tlbToolBar.add(cmbZoom); pnlSep3.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep3); pnlSep4.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep4); pnlSep5.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep5); pnlSep6.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep6); pnlSep7.setMaximumSize(new java.awt.Dimension(10, 10)); tlbToolBar.add(pnlSep7); jButton1.setForeground(new java.awt.Color(255, 0, 0)); jButton1.setText("Cancelar"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); tlbToolBar.add(jButton1); add(tlbToolBar, java.awt.BorderLayout.NORTH); pnlMain.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); } }); pnlMain.setLayout(new java.awt.BorderLayout()); scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); pnlPage.setLayout(new java.awt.BorderLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); jPanel4.setLayout(new java.awt.GridBagLayout()); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); pnlLinks.setLayout(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setBackground(java.awt.Color.gray); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setBackground(java.awt.Color.gray); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER); add(pnlMain, java.awt.BorderLayout.CENTER); pnlStatus.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0)); lblStatus.setFont(new java.awt.Font("Dialog", 1, 10)); lblStatus.setText("Page i of n"); pnlStatus.add(lblStatus); add(pnlStatus, java.awt.BorderLayout.SOUTH); }
From source file:ehospital.Principal.java
private void btn_hospital_eliminarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btn_hospital_eliminarMouseClicked // TODO add your handling code here: int elim = cb_hospital_eliminar.getSelectedIndex(); lista_lugares.remove(elim);/*from w w w . java 2 s . c o m*/ cb_hospital_eliminar.removeItem(elim); DefaultComboBoxModel modelo = new DefaultComboBoxModel(); for (int i = 0; i < lista_lugares.size(); i++) { modelo.addElement(lista_lugares.get(i).getNombre()); } cb_hospital_eliminar.setModel(modelo); System.out.println(lista_lugares.toString()); }