List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel
public DefaultComboBoxModel(Vector<E> v)
From source file:com.fratello.longevity.smooth.AppGUI.java
private void initialize() { LabelMaxSize = 0;/*w w w. j av a 2 s.c om*/ ActiveGUI = true; GUI_Start = false; GUI_Pause = true; GUI_Stop = false; ran_at_least_once = false; execute(); initializeFields(); frmFileSystemSearch = new JFrame(); frmFileSystemSearch.setTitle("Smooth Longevity Fratello"); frmFileSystemSearch.setBounds(100, 100, 450, 300); frmFileSystemSearch.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmFileSystemSearch.setResizable(false); UIManager.put("PopupMenu.border", BorderFactory.createLineBorder(Color.black, 1)); JMenuBar menuBar = new JMenuBar(); frmFileSystemSearch.setJMenuBar(menuBar); JMenu mnNewMenu = new JMenu("File"); menuBar.add(mnNewMenu); JMenuItem mntmFirst = new JMenuItem("Open Directory"); mntmFirst.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { openFileChooserDir(mntmFirst); } }); mnNewMenu.add(mntmFirst); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { frmFileSystemSearch.dispose(); } }); mnNewMenu.add(mntmExit); JMenu mnHelp = new JMenu("Help"); menuBar.add(mnHelp); JMenuItem mntmAbout = new JMenuItem("About"); mnHelp.add(mntmAbout); JMenuItem mntmTutorials = new JMenuItem("Tutorials"); mnHelp.add(mntmTutorials); JMenuItem mntmCheckForUpdates = new JMenuItem("Check for Updates"); mnHelp.add(mntmCheckForUpdates); String ppallink = "https://www.paypal.com/cgi-bin/webscr" + "?cmd=" + "_donations" + "&business=" + "8YUJNSN6KFV54" + "&lc=" + "US" + "&item_name=" + "Personal%20funds%20for%20programming%20at%20university" + "¤cy_code=" + "USD" + "&bn=" + "PP%2dDonationsBF" + "%3abtn_donateCC_LG%2egif%3aNonHosted"; JButton btnDonate = new JButton("Donate"); btnDonate.setToolTipText("<html>Open default Internet browser <br>(Chrome, FireFox, etc.)</html>"); btnDonate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { openWebPage(ppallink); } }); btnDonate.setBounds(159, 176, 90, 25); menuBar.add(btnDonate); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); frmFileSystemSearch.getContentPane().add(tabbedPane, BorderLayout.CENTER); // ---------------------------- JPanels ------------------------------ JPanel panel = new JPanel(); tabbedPane.addTab("Start Directory", null, panel, null); JPanel panel_1 = new JPanel(); tabbedPane.addTab("Search Setup", null, panel_1, null); panel_1.setLayout(null); JPanel panel_2 = new JPanel(); tabbedPane.addTab("Run Program", null, panel_2, null); panel_2.setLayout(null); JPanel panel_3 = new JPanel(); tabbedPane.addTab("Information", null, panel_3, null); panel_3.setBounds(10, 11, 409, 154); GridBagLayout gbl_panel_3 = new GridBagLayout(); gbl_panel_3.columnWidths = new int[] { 0, 0, 0 }; gbl_panel_3.rowHeights = new int[] { 0, 0, 0 }; gbl_panel_3.columnWeights = new double[] { 1.0, 1.0, 1.0 }; gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; panel_3.setLayout(gbl_panel_3); // ------------- Dynamic Update - Swingworker Components ------------- SentinelProgressBar = new JProgressBar(); SentinelProgressBar.setMaximumSize(new Dimension(146, 14)); SentinelProgressBar.setMaximum(1000); SentinelProgressBar.setBounds(74, 187, 146, 14); panel_2.add(SentinelProgressBar); SentinelProgressLabel = new JLabel(); SentinelProgressLabel.setToolTipText("Time needed to finish the program in progress"); SentinelProgressLabel.setBounds(333, 181, 86, 20); panel_2.add(SentinelProgressLabel); // ------------------------------------------------------------------- // ------------------------ JPanel Components ------------------------ JLabel lblCurrentDirectory = new JLabel("Current Directory"); panel.add(lblCurrentDirectory); userSelectedDirectories = new JTextField(); panel.add(userSelectedDirectories); userSelectedDirectories.setColumns(35); JButton btnBrowse = new JButton("Browse"); btnBrowse.setToolTipText("Locate directory in system"); btnBrowse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { openFileChooserDir(btnBrowse); } }); panel.add(btnBrowse); JButton btnClear = new JButton("Clear"); btnClear.setToolTipText("Deletes the current directory shown"); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { userSelectedDirectories.setText(""); clearSourceDirectory(); } }); panel.add(btnClear); // ------------------------------------------------------------------- // ----------------------- JPanel_1 Components ----------------------- // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Extension :: [Check Box] chckbxExt = new JCheckBox("Extension"); chckbxExt.setToolTipText("Check to ignore file extensions"); chckbxExt.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) cf.setUse("Ext", true); else if (e.getStateChange() == ItemEvent.DESELECTED) cf.setUse("Ext", false); } }); chckbxExt.setBounds(8, 15, 97, 23); panel_1.add(chckbxExt); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Hash :: [Check Box] chckbxHash = new JCheckBox("Hash"); chckbxHash.setToolTipText("Check to compare by hashing files (FAST)"); chckbxHash.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) cf.setUse("Hash", true); else if (e.getStateChange() == ItemEvent.DESELECTED) cf.setUse("Hash", false); } }); chckbxHash.setBounds(8, 45, 97, 23); panel_1.add(chckbxHash); // Hash :: [Combo Box] comboBoxHash = new JComboBox<String>(); comboBoxHash.setToolTipText( "<html>Hash algorithm to use in file hashing <br>(note - SHA-512 may not be <br>supported by your computer)</html>"); comboBoxHash.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @SuppressWarnings("unchecked") JComboBox<String> cb = (JComboBox<String>) e.getSource(); String UIselect = (String) cb.getSelectedItem(); cf.setHashString(UIselect); } }); comboBoxHash .setModel(new DefaultComboBoxModel<String>(new String[] { "MD5", "SHA-1", "SHA-256", "SHA-512" })); comboBoxHash.setBounds(150, 44, 75, 25); panel_1.add(comboBoxHash); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Name :: [Check Box] chckbxName = new JCheckBox("Name"); chckbxName.setToolTipText("Name tool-tip goes here"); chckbxName.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) cf.setUse("Name", true); else if (e.getStateChange() == ItemEvent.DESELECTED) cf.setUse("Name", false); } }); chckbxName.setBounds(8, 75, 97, 23); panel_1.add(chckbxName); // Name :: [Text Field] namePercentMatchTextField = new JFormattedTextField(new Double(0.0d)); namePercentMatchTextField.setFormatterFactory(new DoubleDocListener(namePercentMatchTextField)); namePercentMatchTextField.getDocument() .addDocumentListener(new DoubleDocListener(namePercentMatchTextField)); namePercentMatchTextField.setToolTipText("Match file names by percentage [00.00-100.00]"); namePercentMatchTextField.setBounds(150, 74, 110, 25); panel_1.add(namePercentMatchTextField); namePercentMatchTextField.setColumns(10); // Name :: [Combo Box] comboBoxNames = new JComboBox<String>(); comboBoxNames.setToolTipText("Algorithm to compare names"); comboBoxNames.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @SuppressWarnings("unchecked") JComboBox<String> cb = (JComboBox<String>) e.getSource(); String UIselect = (String) cb.getSelectedItem(); cf.setMatchingAlgorithm(UIselect); } }); comboBoxNames.setModel(new DefaultComboBoxModel<String>(new String[] { "Bitap", "Cosine", "DamerauLevenshtein", "DynamicTimeWarpingStandard1", "DynamicTimeWarpingStandard2", "Hamming", "Hirschberg", "JaccardIndex", "JaroWinkler", "Levenshtein", "NeedlemanWunsch", "SmithWaterman", "SorensenSimilarityIndex", "WagnerFischer" })); comboBoxNames.setBounds(265, 74, 150, 25); panel_1.add(comboBoxNames); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Size :: [Check Box] chckbxSize = new JCheckBox("Size"); chckbxSize.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) cf.setUse("Size", true); else if (e.getStateChange() == ItemEvent.DESELECTED) cf.setUse("Size", false); } }); chckbxSize.setBounds(8, 105, 97, 23); panel_1.add(chckbxSize); // Size :: [Text Field] sizePercentMatchTextField = new JFormattedTextField(new Double(0.0d)); sizePercentMatchTextField.setFormatterFactory(new DoubleDocListener(sizePercentMatchTextField)); sizePercentMatchTextField.getDocument() .addDocumentListener(new DoubleDocListener(sizePercentMatchTextField)); sizePercentMatchTextField.setToolTipText("Match file sizes by percentage [00.00-100.00]"); sizePercentMatchTextField.setBounds(150, 104, 110, 25); panel_1.add(sizePercentMatchTextField); sizePercentMatchTextField.setColumns(10); // Size :: [Combo Box] comboBoxSize = new JComboBox<String>(); comboBoxSize.setToolTipText("Specify byte grouping"); comboBoxSize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @SuppressWarnings("unchecked") JComboBox<String> cb = (JComboBox<String>) e.getSource(); String UIselect = (String) cb.getSelectedItem(); cf.setMetricSize(UIselect); } }); comboBoxSize.setModel( new DefaultComboBoxModel<String>(new String[] { "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE" })); comboBoxSize.setBounds(265, 104, 150, 25); panel_1.add(comboBoxSize); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Thorough :: [Check Box] chckbxThorough = new JCheckBox("Thorough"); chckbxThorough.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) cf.setUse("Thorough", true); else if (e.getStateChange() == ItemEvent.DESELECTED) cf.setUse("Thorough", false); } }); chckbxThorough.setToolTipText("Check byte by byte"); chckbxThorough.setBounds(8, 135, 97, 23); panel_1.add(chckbxThorough); // Thorough :: [Text Field] thoroughPercentMatchTextField = new JFormattedTextField(new Double(0.0d)); thoroughPercentMatchTextField.setFormatterFactory(new DoubleDocListener(thoroughPercentMatchTextField)); thoroughPercentMatchTextField.getDocument() .addDocumentListener(new DoubleDocListener(thoroughPercentMatchTextField)); thoroughPercentMatchTextField.setToolTipText("Match file sizes by percentage [00.00-100.00]"); thoroughPercentMatchTextField.setBounds(150, 134, 110, 25); panel_1.add(thoroughPercentMatchTextField); thoroughPercentMatchTextField.setColumns(10); // Thorough :: [Check Box] chckbxExitFast = new JCheckBox("Exit Fast"); chckbxExitFast.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) cf.setThoroughExitFirstByteMisMatch(true); else if (e.getStateChange() == ItemEvent.DESELECTED) cf.setThoroughExitFirstByteMisMatch(false); } }); chckbxExitFast.setToolTipText("<html>When the first byte comparison <br>is a mis-match then stop</html>"); chckbxExitFast.setBounds(265, 138, 105, 16); panel_1.add(chckbxExitFast); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ JButton btnSaveSearchSettings = new JButton("Save Search Settings"); btnSaveSearchSettings.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { pollSearchSettings(); cf.saveObject(); // System.out.println(cf.toString()); // debug } }); btnSaveSearchSettings.setBounds(292, 181, 140, 25); panel_1.add(btnSaveSearchSettings); JButton btnLoadSettings = new JButton("Load Settings"); btnLoadSettings.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (!cf.loadObject()) cf.setDefaultSettings(); cacheUpdateGUISettings(); } }); btnLoadSettings.setBounds(148, 181, 140, 25); panel_1.add(btnLoadSettings); JButton btnDefaultSettings = new JButton("Use Default Settings"); btnDefaultSettings.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { cf.setDefaultSettings(); cacheUpdateGUISettings(); } }); btnDefaultSettings.setBounds(4, 181, 140, 25); panel_1.add(btnDefaultSettings); // ------------------------------------------------------------------- // ----------------------- JPanel_2 Components ----------------------- JLabel labelStatus = new JLabel("Progress"); labelStatus.setBounds(10, 187, 54, 14); panel_2.add(labelStatus); JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pollSearchSettings(); if (!ran_at_least_once) ran_at_least_once = true; else { SentinelProgressBar.setValue(0); SentinelProgressLabel.setText("Waiting..."); } try { if (multiSelection == null) { JOptionPane.showMessageDialog(btnStart, "Please enter at least one directory.", "Press OK to continue", JOptionPane.PLAIN_MESSAGE); return; } setSourceDirectory(multiSelection); GUI_Start = true; } catch (Exception err) { err.printStackTrace(); } } }); btnStart.setBounds(40, 153, 89, 23); panel_2.add(btnStart); JButton btnStop = new JButton("Stop"); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { GUI_Stop = true; } }); btnStop.setBounds(169, 153, 89, 23); panel_2.add(btnStop); JButton btnNewButton = new JButton("Pause"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { GUI_Pause = true; } }); btnNewButton.setBounds(298, 153, 89, 23); panel_2.add(btnNewButton); JCheckBox chckbxDeleteDuplicateFiles = new JCheckBox("Delete duplicate files"); chckbxDeleteDuplicateFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { deleteCopyResults = true; } }); chckbxDeleteDuplicateFiles.setBounds(230, 10, 150, 16); panel_2.add(chckbxDeleteDuplicateFiles); JCheckBox chckbxLogDuplicateFiles = new JCheckBox("Save duplicates to file"); chckbxLogDuplicateFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { saveCopyResults = true; } }); chckbxLogDuplicateFiles.setBounds(230, 36, 150, 16); panel_2.add(chckbxLogDuplicateFiles); // ------------------------------------------------------------------- // ----------------------- JPanel_3 Components ----------------------- JLabel lblAbout = new JLabel("About"); GridBagConstraints gbc_lblAbout = new GridBagConstraints(); gbc_lblAbout.insets = new Insets(0, 0, 5, 5); gbc_lblAbout.gridx = 0; gbc_lblAbout.gridy = 0; panel_3.add(lblAbout, gbc_lblAbout); JLabel lblTutorials = new JLabel("Tutorials"); GridBagConstraints gbc_lblTutorials = new GridBagConstraints(); gbc_lblTutorials.insets = new Insets(0, 0, 5, 5); gbc_lblTutorials.gridx = 1; gbc_lblTutorials.gridy = 0; panel_3.add(lblTutorials, gbc_lblTutorials); JLabel lblUpdates = new JLabel("Updates"); GridBagConstraints gbc_lblUpdates = new GridBagConstraints(); gbc_lblUpdates.insets = new Insets(0, 0, 5, 0); gbc_lblUpdates.gridx = 2; gbc_lblUpdates.gridy = 0; panel_3.add(lblUpdates, gbc_lblUpdates); JButton btnInformation = new JButton("Information"); btnInformation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { openWebPage(ppallink); } }); GridBagConstraints gbc_btnInformation = new GridBagConstraints(); gbc_btnInformation.insets = new Insets(0, 0, 0, 5); gbc_btnInformation.gridx = 0; gbc_btnInformation.gridy = 1; panel_3.add(btnInformation, gbc_btnInformation); JButton btnExamples = new JButton("Examples"); btnExamples.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { openWebPage(ppallink); } }); GridBagConstraints gbc_btnExamples = new GridBagConstraints(); gbc_btnExamples.insets = new Insets(0, 0, 0, 5); gbc_btnExamples.gridx = 1; gbc_btnExamples.gridy = 1; panel_3.add(btnExamples, gbc_btnExamples); JButton btnCheckNow = new JButton("Check Now"); btnCheckNow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { openWebPage(ppallink); } }); GridBagConstraints gbc_btnCheckNow = new GridBagConstraints(); gbc_btnCheckNow.gridx = 2; gbc_btnCheckNow.gridy = 1; panel_3.add(btnCheckNow, gbc_btnCheckNow); }
From source file:com.cch.aj.entryrecorder.frame.EntryJFrame.java
private int FillEntryComboBox(JComboBox comboBox, int id) { int result = -1; List<Entry> allEntrys = this.entryService.GetAllEntities(); if (allEntrys.size() > 0) { List<Entry> entrys = allEntrys.stream().filter(x -> x.getShift().equals(this.txtEntrySearch.getText())) .collect(Collectors.toList()); if (entrys.size() > 0) { List<ComboBoxItem<Entry>> entryNames = entrys.stream().sorted(comparing(x -> x.getCreateDate())) .map(x -> ComboBoxItemConvertor.ConvertToComboBoxItem(x, (x.getMachineId() != null ? x.getMachineId().getMachineNo() : "New") + " / " + (x.getProductId() != null ? x.getProductId().getCode() : "NA"), x.getId()))/*from w w w .j a va 2 s .co m*/ .collect(Collectors.toList()); Entry entry = new Entry(); entry.setId(0); entry.setShift("- Select -"); entryNames.add(0, new ComboBoxItem<Entry>(entry, entry.getShift(), entry.getId())); ComboBoxItem[] entryNamesArray = entryNames.toArray(new ComboBoxItem[entryNames.size()]); comboBox.setModel(new DefaultComboBoxModel(entryNamesArray)); if (id != 0) { ComboBoxItem<Entry> currentEntryName = entryNames.stream().filter(x -> x.getId() == id) .findFirst().get(); result = entryNames.indexOf(currentEntryName); } else { result = 0; } comboBox.setSelectedIndex(result); } else { JOptionPane.showMessageDialog(this, "No entry has been found.", "Info", JOptionPane.OK_OPTION); } } return result; }
From source file:be.nbb.demetra.dfm.output.simulation.RealTimePerspGraphView.java
private DefaultComboBoxModel toComboBoxModel(List<DfmSeriesDescriptor> data) { List<DfmSeriesDescriptor> desc = new ArrayList<>(); List<Boolean> watched = dfmSimulation.get().getWatched(); for (int i = 0; i < watched.size(); i++) { if (watched.get(i)) { desc.add(data.get(i));/*w w w . ja v a 2 s.c o m*/ } } DefaultComboBoxModel result = new DefaultComboBoxModel(desc.toArray()); return result; }
From source file:com.cch.aj.entryrecorder.frame.SettingsJFrame.java
private void UpdateTabPolymer(int id) { int selectedIndex = FillPolymerComboBox(this.cbPolymer, id); if (selectedIndex >= 0) { Polymer currentPolymer = ((ComboBoxItem<Polymer>) this.cbPolymer.getSelectedItem()).getItem(); //// w ww .jav a2s . c o m this.txtPolymerCompany .setText(currentPolymer.getCompany() == null || currentPolymer.getCompany() == "- Select -" ? "" : currentPolymer.getCompany().toString()); this.txtPolymerDesc.setText( currentPolymer.getDescription() == null ? "" : currentPolymer.getDescription().toString()); this.txtPolymerGrade .setText(currentPolymer.getGrade() == null ? "" : currentPolymer.getGrade().toString()); } else { this.cbPolymer.setModel(new DefaultComboBoxModel(new ComboBoxItem[] {})); this.txtPolymerCompany.setText(""); this.txtPolymerDesc.setText(""); this.txtPolymerGrade.setText(""); } if (this.cbPolymer.getSelectedItem() == null || ((ComboBoxItem<Polymer>) this.cbPolymer.getSelectedItem()).getId() == 0) { this.pnlEditPolymer.setVisible(false); this.btnPolymerDelete.setVisible(false); this.btnPolymerSave.setVisible(false); this.btnPolymerUndo.setVisible(false); } else { this.pnlEditPolymer.setVisible(true); this.btnPolymerDelete.setVisible(true); this.btnPolymerSave.setVisible(true); this.btnPolymerUndo.setVisible(true); } }
From source file:at.becast.youploader.gui.FrmMain.java
public void initMainTab() { cmbCategory = new JComboBox<Categories>(); cmbCategory.setModel(new DefaultComboBoxModel<Categories>(Categories.values())); SideBar sideBar = new SideBar(SideBar.SideBarMode.TOP_LEVEL, true, 300, true); ss1 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Settings"), new EditPanel(this), new ImageIcon(getClass().getResource("/pencil.png"))); ss2 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Playlists"), new PlaylistPanel(this), new ImageIcon(getClass().getResource("/layers.png"))); ss3 = new SidebarSection(sideBar, LANG.getString("frmMain.Sidebar.Monetisation"), new MonetPanel(), new ImageIcon(getClass().getResource("/money.png"))); sideBar.addSection(ss1, false);//from ww w . ja v a2 s .c o m sideBar.addSection(ss2); sideBar.addSection(ss3); JPanel mainTab = new JPanel(); JPanel panel = new JPanel(); GroupLayout mainTabLayout = new GroupLayout(mainTab); mainTabLayout.setHorizontalGroup(mainTabLayout.createParallelGroup(Alignment.TRAILING) .addGroup(mainTabLayout.createSequentialGroup() .addComponent(panel, GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE))); mainTabLayout.setVerticalGroup(mainTabLayout.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE) .addGroup(mainTabLayout.createSequentialGroup() .addComponent(sideBar, GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE).addContainerGap())); panel.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("2px"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20px:grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("23px"), ColumnSpec.decode("33px"), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("61px"), FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("24px"), ColumnSpec.decode("28px"), ColumnSpec.decode("40px"), ColumnSpec.decode("36px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("28px"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("58px"), }, new RowSpec[] { RowSpec.decode("2px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("14px"), RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("64dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("max(64dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, RowSpec.decode("25px"), FormSpecs.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("24px"), RowSpec.decode("23px"), })); lbltitlelenght = new JLabel("(0/100)"); panel.add(lbltitlelenght, "14, 6, 3, 1, right, top"); txtTitle = new JTextField(); contextMenu.add(txtTitle); panel.add(txtTitle, "3, 7, 14, 1, fill, fill"); txtTitle.setColumns(10); txtTitle.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblCategory = new JLabel(LANG.getString("frmMain.Category")); panel.add(lblCategory, "3, 9, 4, 1, left, bottom"); panel.add(cmbCategory, "3, 10, 14, 1, fill, fill"); JLabel lblDescription = new JLabel(LANG.getString("frmMain.Description")); panel.add(lblDescription, "3, 12, 4, 1, left, bottom"); lblDesclenght = new JLabel("(0/5000)"); panel.add(lblDesclenght, "14, 12, 3, 1, right, bottom"); JScrollPane DescriptionScrollPane = new JScrollPane(); panel.add(DescriptionScrollPane, "3, 13, 14, 1, fill, fill"); txtDescription = new JTextArea(); contextMenu.add(txtDescription); txtDescription.setFont(new Font("SansSerif", Font.PLAIN, 13)); DescriptionScrollPane.setViewportView(txtDescription); txtDescription.setWrapStyleWord(true); txtDescription.setLineWrap(true); txtDescription.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblTags = new JLabel(LANG.getString("frmMain.Tags")); panel.add(lblTags, "3, 15, 4, 1, left, bottom"); lblTagslenght = new JLabel("(0/500)"); panel.add(lblTagslenght, "14, 15, 3, 1, right, top"); JScrollPane TagScrollPane = new JScrollPane(); panel.add(TagScrollPane, "3, 16, 14, 1, fill, fill"); txtTags = new JTextArea(); contextMenu.add(txtTags); txtTags.setFont(new Font("SansSerif", Font.PLAIN, 13)); TagScrollPane.setViewportView(txtTags); txtTags.setWrapStyleWord(true); txtTags.setLineWrap(true); txtTags.setBorder(BorderFactory.createEtchedBorder()); txtTags.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { calcNotifies(); } }); JLabel lblAccount = new JLabel(LANG.getString("frmMain.Account")); panel.add(lblAccount, "3, 18, 4, 1, left, bottom"); cmbAccount = new JComboBox<AccountType>(); panel.add(getCmbAccount(), "3, 19, 14, 1, fill, fill"); cmbAccount.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { changeUser(); } }); btnAddToQueue = new JButton(LANG.getString("frmMain.addtoQueue")); btnAddToQueue.setEnabled(false); panel.add(btnAddToQueue, "3, 21, 6, 1, fill, fill"); btnAddToQueue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { queueButton(); } }); JLabel lblSelectVideo = new JLabel(); panel.add(lblSelectVideo, "3, 3, 4, 1, left, bottom"); lblSelectVideo.setText(LANG.getString("frmMain.selectVideoFile")); cmbFile = new JComboBox<String>(); cmbFile.setDropTarget(new DropTarget() { private static final long serialVersionUID = 8809983794742040683L; public synchronized void drop(DropTargetDropEvent evt) { try { evt.acceptDrop(DnDConstants.ACTION_COPY); @SuppressWarnings("unchecked") List<File> droppedFiles = (List<File>) evt.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); for (File file : droppedFiles) { cmbFile.removeAllItems(); cmbFile.addItem(file.getAbsolutePath()); } } catch (Exception ex) { LOG.error("Error dropping video file", ex); } } }); panel.add(cmbFile, "3, 4, 14, 1, fill, fill"); JButton btnSelectMovie = new JButton(); btnSelectMovie.setToolTipText("Select Video File"); panel.add(btnSelectMovie, "18, 4, center, top"); btnSelectMovie.setIcon(new ImageIcon(getClass().getResource("/film_add.png"))); JLabel lblTitle = new JLabel(LANG.getString("frmMain.Title")); panel.add(lblTitle, "3, 6, 4, 1, left, bottom"); JButton btnReset = new JButton(LANG.getString("frmMain.Reset")); btnReset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetEdit(); } }); panel.add(btnReset, "11, 21, 6, 1, fill, fill"); btnSelectMovie.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EditPanel edit = (EditPanel) ss1.contentPane; NativeJFileChooser chooser; if (edit.getTxtStartDir() != null && !edit.getTxtStartDir().equals("")) { chooser = new NativeJFileChooser(edit.getTxtStartDir().getText().trim()); } else { chooser = new NativeJFileChooser(); } int returnVal = chooser.showOpenDialog((Component) self); if (returnVal == JFileChooser.APPROVE_OPTION) { cmbFile.removeAllItems(); cmbFile.addItem(chooser.getSelectedFile().getAbsolutePath().toString()); } } }); mainTab.setLayout(mainTabLayout); mainTab.revalidate(); mainTab.repaint(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.VideoSettings"), mainTab); }
From source file:io.github.jeddict.jpa.modeler.properties.fieldtype.FieldTypePanel.java
private void initTypeComboBox() { TitledBorder titledBorder = (TitledBorder) jLayeredPane1.getBorder(); // type_LayeredPane.setVisible(false); List<String> type = new ArrayList<>(); type.add(DEFAULT);/*w w w .ja v a 2s .c o m*/ if (mapKey) { type.add(ENUMERATED); type.add(TEMPORAL); type.add(ENTITY); type.add(EMBEDDABLE); titledBorder.setTitle("MapKey Attribute"); } else if (attribute instanceof PersistenceBaseAttribute) { type.add(TEMPORAL); if (attribute instanceof Basic) { type.add(ENUMERATED); type.add(LOB); titledBorder.setTitle("Basic Attribute"); } else if (attribute instanceof Id) { titledBorder.setTitle("Id Attribute"); } else if (attribute instanceof Version) { titledBorder.setTitle("Version Attribute"); } } else if (attribute instanceof ElementCollection) { type.add(ENUMERATED); type.add(LOB); type.add(TEMPORAL); titledBorder.setTitle("ElementCollection<Basic> Attribute"); } else if (attribute instanceof Transient) { titledBorder.setTitle("Transient Attribute"); } else if (attribute instanceof BeanAttribute || attribute instanceof BeanCollectionAttribute) { titledBorder.setTitle("Attribute"); } type_ComboBox.removeAllItems(); type_ComboBox.setModel(new DefaultComboBoxModel(type.toArray(new String[0]))); // if(type.size() == 1){ // type_LayeredPane.setVisible(false); // } //ElementCollection[Basic Type Value] => Lob,Enumerated,Temporal //Id => Temporal }
From source file:com.floreantpos.ui.model.MenuItemForm.java
/** This method is called from within the constructor to * initialize the form.// w w w .ja v a 2 s .co 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() { lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$ tfStockCount = new DoubleTextField(1); cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$ lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$ tabbedPane = new javax.swing.JTabbedPane(); tabGeneral = new javax.swing.JPanel(); lfname = new javax.swing.JLabel(); lfname.setHorizontalAlignment(SwingConstants.TRAILING); tfName = new com.floreantpos.swing.FixedLengthTextField(20); lgroup = new javax.swing.JLabel(); lgroup.setHorizontalAlignment(SwingConstants.TRAILING); cbGroup = new javax.swing.JComboBox(); cbGroup.setPreferredSize(new Dimension(198, 0)); btnNewGroup = new javax.swing.JButton(); lblPrice = new javax.swing.JLabel(); lblPrice.setHorizontalAlignment(SwingConstants.TRAILING); tfPrice = new DoubleTextField(20); tfPrice.setHorizontalAlignment(javax.swing.JTextField.RIGHT); tfDescription = new JTextArea(new FixedLengthDocument(255)); //tfDescription.setDocument(; tfUnitName = new FixedLengthTextField(20); lTax = new javax.swing.JLabel(); lTax.setHorizontalAlignment(SwingConstants.TRAILING); cbTax = new javax.swing.JComboBox(); btnNewTax = new javax.swing.JButton(); lDiscountRate = new javax.swing.JLabel(); lDiscountRate.setHorizontalAlignment(SwingConstants.TRAILING); lPercentage = new javax.swing.JLabel(); tfDiscountRate = new DoubleTextField(18); tfDiscountRate.setHorizontalAlignment(SwingConstants.TRAILING); chkVisible = new javax.swing.JCheckBox(); tabModifier = new javax.swing.JPanel(); btnNewModifierGroup = new javax.swing.JButton(); btnDeleteModifierGroup = new javax.swing.JButton(); btnEditModifierGroup = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tableTicketItemModifierGroups = new javax.swing.JTable(); tabShift = new javax.swing.JPanel(); tabPrice = new javax.swing.JPanel(); tabButtonStyle = new javax.swing.JPanel(); btnDeleteShift = new javax.swing.JButton(); btnAddShift = new javax.swing.JButton(); btnNewPrice = new javax.swing.JButton(); btnUpdatePrice = new javax.swing.JButton(); btnDeletePrice = new javax.swing.JButton(); btnDeleteAll = new javax.swing.JButton(); btnDefaultValue = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); jScrollPane3 = new javax.swing.JScrollPane(); shiftTable = new javax.swing.JTable(); priceTable = new javax.swing.JTable(); cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>( PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0]))); cbPrinterGroup.setPreferredSize(new Dimension(226, 0)); tfTranslatedName = new FixedLengthTextField(20); tfTranslatedName.setLength(120); lblUnitName = new JLabel(Messages.getString("MenuItemForm.23")); //$NON-NLS-1$ lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$ lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$ lfname.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$ tfName.setLength(120); lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$ tfBarcode = new FixedLengthTextField(20); tfSortOrder = new IntegerTextField(20); lblSortOrder = new JLabel(Messages.getString("MenuItemForm.lblSortOrder.text")); //$NON-NLS-1$ tfSortOrder.setText(""); //$NON-NLS-1$ lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$ cbTax.setPreferredSize(new Dimension(198, 0)); ///lblButtonColor = new JLabel(Messages.getString("MenuItemForm.lblButtonColor.text")); //$NON-NLS-1$ btnButtonColor = new JButton(); //$NON-NLS-1$ btnButtonColor.setPreferredSize(new Dimension(228, 40)); lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$ btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$ // btnTextColor.setPreferredSize(new Dimension(228, 40)); cbShowTextWithImage = new JCheckBox(Messages.getString("MenuItemForm.40")); //$NON-NLS-1$ cbShowTextWithImage.setActionCommand(Messages.getString("MenuItemForm.41")); //$NON-NLS-1$ lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ cbFractionalUnit = new JCheckBox(Messages.getString("MenuItemForm.24")); //$NON-NLS-1$ btnNewGroup.setText("..."); //$NON-NLS-1$ btnNewGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doCreateNewGroup(evt); } }); if (Application.getInstance().isPriceIncludesTax()) { lblPrice.setText(Messages.getString("LABEL_SALES_PRICE_INCLUDING_TAX")); //$NON-NLS-1$ } else { lblPrice.setText(Messages.getString("LABEL_SALES_PRICE_EXCLUDING_TAX")); //$NON-NLS-1$ } tfPrice.setHorizontalAlignment(javax.swing.JTextField.RIGHT); lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ btnNewTax.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewTaxdoCreateNewTax(evt); } }); lDiscountRate.setText(com.floreantpos.POSConstants.DISCOUNT_RATE + ":"); //$NON-NLS-1$ lPercentage.setText("%"); //$NON-NLS-1$ chkVisible.setText(com.floreantpos.POSConstants.VISIBLE); chkVisible.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); chkVisible.setMargin(new java.awt.Insets(0, 0, 0, 0)); tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral); tabbedPane.setPreferredSize(new Dimension(750, 470)); btnNewModifierGroup.setText(com.floreantpos.POSConstants.ADD); btnNewModifierGroup.setActionCommand("AddModifierGroup"); //$NON-NLS-1$ btnNewModifierGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewModifierGroupActionPerformed(evt); } }); btnDeleteModifierGroup.setText(com.floreantpos.POSConstants.DELETE); btnDeleteModifierGroup.setActionCommand("DeleteModifierGroup"); //$NON-NLS-1$ btnEditModifierGroup.setText(com.floreantpos.POSConstants.EDIT); btnEditModifierGroup.setActionCommand("EditModifierGroup"); //$NON-NLS-1$ menuItemMGListModel = new MenuItemMGListModel(); tableTicketItemModifierGroups.setModel(menuItemMGListModel); btnNewModifierGroup.addActionListener(this); btnEditModifierGroup.addActionListener(this); btnDeleteModifierGroup.addActionListener(this); btnAddShift.addActionListener(this); btnDeleteShift.addActionListener(this); tfDiscountRate.setDocument(new DoubleDocument()); tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /*JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabGeneral.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabGeneral.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); tabGeneral.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); tabGeneral.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ */ tabGeneral.add(lfname, "cell 0 1 ,right"); //$NON-NLS-1$ tabGeneral.add(tfName, "cell 1 1,grow"); //$NON-NLS-1$ tabGeneral.add(lblTranslatedName, "cell 0 2,right"); //$NON-NLS-1$ tabGeneral.add(tfTranslatedName, "cell 1 2,grow"); //$NON-NLS-1$ /*tabGeneral.add(new JLabel("Description"), "cell 0 3,right"); JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tabGeneral.add(scrlDescription, "cell 1 3");*/ tabGeneral.add(lblUnitName, "cell 0 3,right"); //$NON-NLS-1$ tabGeneral.add(tfUnitName, "cell 1 3,grow"); //$NON-NLS-1$ JLabel lblBuyPrice = new JLabel(Messages.getString("LABEL_BUY_PRICE")); //$NON-NLS-1$ tabGeneral.add(lblBuyPrice, "cell 0 4,alignx right"); //$NON-NLS-1$ tfBuyPrice = new DoubleTextField(20); tfBuyPrice.setHorizontalAlignment(SwingConstants.TRAILING); tabGeneral.add(tfBuyPrice, "cell 1 4,grow"); //$NON-NLS-1$ tabGeneral.add(lblPrice, "cell 0 5,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfPrice, "cell 1 5,grow"); //$NON-NLS-1$ tabGeneral.add(lgroup, "cell 0 6,alignx right"); //$NON-NLS-1$ tabGeneral.add(cbGroup, "cell 1 6"); //$NON-NLS-1$ tabGeneral.add(btnNewGroup, "cell 1 6"); //$NON-NLS-1$ tabGeneral.add(lblBarcode, "cell 0 7,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfBarcode, "cell 1 7,grow"); //$NON-NLS-1$ tabGeneral.add(lblSortOrder, "cell 0 8,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfSortOrder, "cell 1 8,grow"); //$NON-NLS-1$ tabGeneral.add(lblStockCount, "cell 0 9,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfStockCount, "cell 1 9,grow"); //$NON-NLS-1$ //tabGeneral.add(cbShowTextWithImage, "cell 1 8"); //$NON-NLS-1$ tabGeneral.add(chkVisible, "cell 1 10"); //$NON-NLS-1$ tabGeneral.add(cbFractionalUnit, "cell 1 11"); //$NON-NLS-1$ tabGeneral.add(cbDisableStockCount, "cell 1 12"); //$NON-NLS-1$ // right side tabGeneral.add(lblKitchenPrinter, "cell 2 1,right"); //$NON-NLS-1$ tabGeneral.add(cbPrinterGroup, "cell 3 1,grow"); //$NON-NLS-1$ tabGeneral.add(lTax, "cell 2 2,right"); //$NON-NLS-1$ tabGeneral.add(cbTax, "cell 3 2"); //$NON-NLS-1$ tabGeneral.add(btnNewTax, "cell 3 2,grow"); //$NON-NLS-1$ /*tabGeneral.add(lblButtonColor, "cell 2 3,right"); //$NON-NLS-1$ tabGeneral.add(btnButtonColor, "cell 3 3,grow"); //$NON-NLS-1$ tabGeneral.add(lblTextColor, "cell 2 4,right"); //$NON-NLS-1$ tabGeneral.add(btnTextColor, "cell 3 4 3 5"); //$NON-NLS-1$ btnTextColor.setPreferredSize(new Dimension(228, 50));*/ tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,,aligny top,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ orderList = new CheckBoxList(); List<OrderType> orderTypes = Application.getInstance().getOrderTypes(); orderList.setModel(orderTypes); // List<String> orderListM = new ArrayList(); // orderListM.add(OrderType.DINE_IN.toString()); // orderListM.add(OrderType.BAR_TAB.toString()); // orderListM.add(OrderType.DRIVE_THRU.toString()); // orderListM.add(OrderType.HOME_DELIVERY.toString()); // orderListM.add(OrderType.PICKUP.toString()); // orderListM.add(OrderType.RETAIL.toString()); // orderListM.add(OrderType.TAKE_OUT.toString()); // orderList.setModel(orderListM); JScrollPane orderCheckBoxList = new JScrollPane(orderList); orderCheckBoxList.setPreferredSize(new Dimension(228, 100)); tabGeneral.add(orderCheckBoxList, "cell 3 3 3 4"); //$NON-NLS-1$ tfDescription.setWrapStyleWord(true); tfDescription.setLineWrap(true); tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 7,aligny top,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrlDescription.setPreferredSize(new Dimension(228, 90)); tabGeneral.add(scrlDescription, "cell 3 7 3 4"); //$NON-NLS-1$ add(tabbedPane); //TODO: addRecepieExtension(); /*btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.42"), btnButtonColor.getBackground()); //$NON-NLS-1$ btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$ btnTextColor.setForeground(color); } });*/ jScrollPane1.setViewportView(tableTicketItemModifierGroups); GroupLayout jPanel2Layout = new GroupLayout(tabModifier); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnDeleteModifierGroup).addComponent(btnEditModifierGroup) .addComponent(btnNewModifierGroup)) .addContainerGap())); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout .createParallelGroup(Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addComponent(btnNewModifierGroup) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnEditModifierGroup) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDeleteModifierGroup)) .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)) .addContainerGap())); tabModifier.setLayout(jPanel2Layout); tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, tabModifier); btnDeleteShift.setText(com.floreantpos.POSConstants.DELETE_SHIFT); btnAddShift.setText(com.floreantpos.POSConstants.ADD_SHIFT); shiftTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane2.setViewportView(shiftTable); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(tabShift); tabShift.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap(76, Short.MAX_VALUE) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 670, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup().add(btnAddShift).add(5, 5, 5) .add(btnDeleteShift))) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 345, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(btnAddShift).add(btnDeleteShift)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); tabbedPane.addTab(com.floreantpos.POSConstants.SHIFTS, tabShift); // btnNewPrice.setText(Messages.getString("MenuItemForm.9")); //$NON-NLS-1$ btnNewPrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewPrice(); } }); btnUpdatePrice.setText(Messages.getString("MenuItemForm.13")); //$NON-NLS-1$ btnUpdatePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updatePrice(); } }); btnDeletePrice.setText(Messages.getString("MenuItemForm.14")); //$NON-NLS-1$ btnDeletePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deletePrice(); } }); btnDeleteAll.setText(Messages.getString("MenuItemForm.15")); //$NON-NLS-1$ btnDeleteAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAll(); } }); btnDefaultValue.setText(Messages.getString("MenuItemForm.7")); //$NON-NLS-1$ /*btnDefaultValue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDefaultValue(); } });*/ priceTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane3.setViewportView(priceTable); tabPrice.setLayout(new BorderLayout()); tabPrice.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tabPrice.add(jScrollPane3, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.add(btnNewPrice); buttonPanel.add(btnUpdatePrice); //buttonPanel.add(btnDefaultValue); buttonPanel.add(btnDeletePrice); // buttonPanel.add(btnDeleteAll); tabPrice.add(buttonPanel, BorderLayout.SOUTH); tabbedPane.addTab(Messages.getString("MenuItemForm.16"), tabPrice); //$NON-NLS-1$ // tabbedPane.addChangeListener(this); // tabButtonStyle.setLayout(new MigLayout("insets 10", "[][]100[][][][]", "[][][center][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabButtonStyle.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabButtonStyle.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 2,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 2,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 3,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 3"); //$NON-NLS-1$ tabButtonStyle.add(cbShowTextWithImage, "cell 1 4"); //$NON-NLS-1$ /* tabButtonStyle.add(lblImagePreview, "cell 3 0 3 4"); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 3 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 3 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(lblImage, "cell 2 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 0,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 0,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 1,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 1"); //$NON-NLS-1$ */ btnTextColor.setPreferredSize(new Dimension(228, 50)); btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.42"), //$NON-NLS-1$ btnButtonColor.getBackground()); btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.43"), //$NON-NLS-1$ btnTextColor.getForeground()); btnTextColor.setForeground(color); } }); tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$ }
From source file:io.github.jeddict.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void changeBusinessLayer(TechContext businessLayer) { controllerLayerCombo.setModel(new DefaultComboBoxModel( Generator.getController(businessLayer, isMicroservice() || isGateway()).toArray())); controllerLayerCombo.setEnabled(businessLayer.isValid()); viewerLayerCombo/*from ww w . ja v a2 s . c o m*/ .setModel(new DefaultComboBoxModel(new Object[] { new TechContext(DefaultViewerLayer.class) })); viewerLayerCombo.setEnabled(false); setTechPanel(businessLayer); }
From source file:com.mirth.connect.connectors.file.FileWriter.java
private void initComponents() { schemeLabel = new JLabel(); schemeLabel.setText("Method:"); schemeComboBox = new MirthComboBox(); schemeComboBox.setModel(new DefaultComboBoxModel(new String[] { "file", "ftp", "sftp", "smb", "webdav" })); schemeComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { schemeComboBoxActionPerformed(evt); }/*from www . j a v a2s . c om*/ }); testConnectionButton = new JButton(); testConnectionButton.setText("Test Write"); testConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { testConnectionActionPerformed(evt); } }); advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png"))); advancedSettingsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { advancedFileSettingsActionPerformed(); } }); summaryLabel = new JLabel("Advanced Options:"); summaryField = new JLabel(""); directoryLabel = new JLabel(); directoryLabel.setText("Directory:"); directoryField = new MirthTextField(); hostLabel = new JLabel(); hostLabel.setText("ftp://"); hostField = new MirthTextField(); pathLabel = new JLabel(); pathLabel.setText("/"); pathField = new MirthTextField(); fileNameLabel = new JLabel(); fileNameLabel.setText("File Name:"); fileNameField = new MirthTextField(); anonymousLabel = new JLabel(); anonymousLabel.setText("Anonymous:"); anonymousYesRadio = new MirthRadioButton(); anonymousYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); anonymousYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); anonymousYesRadio.setText("Yes"); anonymousYesRadio.setMargin(new Insets(0, 0, 0, 0)); anonymousYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { anonymousYesActionPerformed(evt); } }); anonymousNoRadio = new MirthRadioButton(); anonymousNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); anonymousNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); anonymousNoRadio.setSelected(true); anonymousNoRadio.setText("No"); anonymousNoRadio.setMargin(new Insets(0, 0, 0, 0)); anonymousNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { anonymousNoActionPerformed(evt); } }); anonymousButtonGroup = new ButtonGroup(); anonymousButtonGroup.add(anonymousYesRadio); anonymousButtonGroup.add(anonymousNoRadio); usernameLabel = new JLabel(); usernameLabel.setText("Username:"); usernameField = new MirthTextField(); passwordLabel = new JLabel(); passwordLabel.setText("Password:"); passwordField = new MirthPasswordField(); timeoutLabel = new JLabel(); timeoutLabel.setText("Timeout (ms):"); timeoutField = new MirthTextField(); secureModeLabel = new JLabel(); secureModeLabel.setText("Secure Mode:"); secureModeYesRadio = new MirthRadioButton(); secureModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); secureModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); secureModeYesRadio.setText("Yes"); secureModeYesRadio.setMargin(new Insets(0, 0, 0, 0)); secureModeYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { secureModeYesActionPerformed(evt); } }); secureModeNoRadio = new MirthRadioButton(); secureModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); secureModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); secureModeNoRadio.setSelected(true); secureModeNoRadio.setText("No"); secureModeNoRadio.setMargin(new Insets(0, 0, 0, 0)); secureModeNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { secureModeNoActionPerformed(evt); } }); secureModeButtonGroup = new ButtonGroup(); secureModeButtonGroup.add(secureModeYesRadio); secureModeButtonGroup.add(secureModeNoRadio); passiveModeLabel = new JLabel(); passiveModeLabel.setText("Passive Mode:"); passiveModeYesRadio = new MirthRadioButton(); passiveModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); passiveModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); passiveModeYesRadio.setText("Yes"); passiveModeYesRadio.setMargin(new Insets(0, 0, 0, 0)); passiveModeNoRadio = new MirthRadioButton(); passiveModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); passiveModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); passiveModeNoRadio.setSelected(true); passiveModeNoRadio.setText("No"); passiveModeNoRadio.setMargin(new Insets(0, 0, 0, 0)); passiveModeButtonGroup = new ButtonGroup(); passiveModeButtonGroup.add(passiveModeYesRadio); passiveModeButtonGroup.add(passiveModeNoRadio); validateConnectionLabel = new JLabel(); validateConnectionLabel.setText("Validate Connection:"); validateConnectionYesRadio = new MirthRadioButton(); validateConnectionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); validateConnectionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); validateConnectionYesRadio.setText("Yes"); validateConnectionYesRadio.setMargin(new Insets(0, 0, 0, 0)); validateConnectionNoRadio = new MirthRadioButton(); validateConnectionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); validateConnectionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); validateConnectionNoRadio.setText("No"); validateConnectionNoRadio.setMargin(new Insets(0, 0, 0, 0)); validateConnectionButtonGroup = new ButtonGroup(); validateConnectionButtonGroup.add(validateConnectionYesRadio); validateConnectionButtonGroup.add(validateConnectionNoRadio); fileExistsLabel = new JLabel(); fileExistsLabel.setText("File Exists:"); fileExistsAppendRadio = new MirthRadioButton(); fileExistsAppendRadio.setBackground(new java.awt.Color(255, 255, 255)); fileExistsAppendRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileExistsAppendRadio.setText("Append"); fileExistsAppendRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); fileExistsAppendRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileExistsAppendRadioActionPerformed(evt); } }); fileExistsOverwriteRadio = new MirthRadioButton(); fileExistsOverwriteRadio.setBackground(new java.awt.Color(255, 255, 255)); fileExistsOverwriteRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileExistsOverwriteRadio.setText("Overwrite"); fileExistsOverwriteRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); fileExistsOverwriteRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileExistsOverwriteRadioActionPerformed(evt); } }); fileExistsErrorRadio = new MirthRadioButton(); fileExistsErrorRadio.setBackground(new java.awt.Color(255, 255, 255)); fileExistsErrorRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileExistsErrorRadio.setSelected(true); fileExistsErrorRadio.setText("Error"); fileExistsErrorRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); fileExistsErrorRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileExistsErrorRadioActionPerformed(evt); } }); fileExistsButtonGroup = new ButtonGroup(); fileExistsButtonGroup.add(fileExistsAppendRadio); fileExistsButtonGroup.add(fileExistsOverwriteRadio); fileExistsButtonGroup.add(fileExistsErrorRadio); tempFileLabel = new JLabel(); tempFileLabel.setText("Create Temp File:"); tempFileYesRadio = new MirthRadioButton(); tempFileYesRadio.setBackground(new java.awt.Color(255, 255, 255)); tempFileYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); tempFileYesRadio.setText("Yes"); tempFileYesRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); tempFileNoRadio = new MirthRadioButton(); tempFileNoRadio.setBackground(new java.awt.Color(255, 255, 255)); tempFileNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); tempFileNoRadio.setSelected(true); tempFileNoRadio.setText("No"); tempFileNoRadio.setMargin(new java.awt.Insets(0, 0, 0, 0)); tempFileButtonGroup = new ButtonGroup(); tempFileButtonGroup.add(tempFileYesRadio); tempFileButtonGroup.add(tempFileNoRadio); fileTypeLabel = new JLabel(); fileTypeLabel.setText("File Type:"); fileTypeBinary = new MirthRadioButton(); fileTypeBinary.setBackground(UIConstants.BACKGROUND_COLOR); fileTypeBinary.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileTypeBinary.setText("Binary"); fileTypeBinary.setMargin(new Insets(0, 0, 0, 0)); fileTypeBinary.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileTypeBinaryActionPerformed(evt); } }); fileTypeText = new MirthRadioButton(); fileTypeText.setBackground(UIConstants.BACKGROUND_COLOR); fileTypeText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileTypeText.setSelected(true); fileTypeText.setText("Text"); fileTypeText.setMargin(new Insets(0, 0, 0, 0)); fileTypeText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileTypeASCIIActionPerformed(evt); } }); fileTypeButtonGroup = new ButtonGroup(); fileTypeButtonGroup.add(fileTypeBinary); fileTypeButtonGroup.add(fileTypeText); encodingLabel = new JLabel(); encodingLabel.setText("Encoding:"); charsetEncodingComboBox = new MirthComboBox(); charsetEncodingComboBox.setModel(new DefaultComboBoxModel(new String[] { "Default", "UTF-8", "ISO-8859-1", "UTF-16 (le)", "UTF-16 (be)", "UTF-16 (bom)", "US-ASCII" })); templateLabel = new JLabel(); templateLabel.setText("Template:"); fileContentsTextPane = new MirthSyntaxTextArea(); fileContentsTextPane.setBorder(BorderFactory.createEtchedBorder()); }
From source file:jeplus.gui.EPlusEditorPanel.java
public final void updateSearchStrings(String[] searchstrings) { if (searchstrings != null) { Vector<String> SSs = new Vector<>(); for (String searchstring : searchstrings) { String[] sstrs = searchstring.split("\\s*\\|\\s*"); SSs.addAll(Arrays.asList(sstrs)); }//from w ww.j a v a 2 s . com this.cboSearchStrings.setModel(new DefaultComboBoxModel(SSs)); this.cboSearchStrings.setEnabled(true); } else { this.cboSearchStrings.setModel(new DefaultComboBoxModel()); this.cboSearchStrings.setEnabled(false); } }