List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel
public DefaultComboBoxModel(Vector<E> v)
From source file:main.UIController.java
/******** FROM GREGORIAN **********/ public void updateDayComboGregorian() { UI window = this.getUi(); JTextField year = window.getYear(); JComboBox month = window.getMonth(); JComboBox day = window.getDay(); JButton convert = window.getToImladris(); JTextPane result = window.getResImladris(); String value = year.getText(); if (!value.isEmpty()) { try {/* ww w . java2 s . c o m*/ int yearNum = Integer.parseInt(value); if (yearNum > 0 && yearNum <= GregorianInfo.MAX_SUPPORTED_YEAR) { int monthNum = month.getSelectedIndex() + 1; int daySel = 0; if (day.isEnabled()) { daySel = day.getSelectedIndex() + 1; } ArrayList<Integer> days = GregorianInfo.getInstance().getDaysArray(yearNum, monthNum); day.setModel(new DefaultComboBoxModel(days.toArray())); if (daySel > 0 && daySel <= days.size()) { day.setSelectedIndex(daySel - 1); } day.setEnabled(true); convert.setEnabled(true); result.setText(""); } else { day.setEnabled(false); convert.setEnabled(false); day.setModel(new DefaultComboBoxModel()); result.setText(""); } } catch (NumberFormatException e) { day.setEnabled(false); convert.setEnabled(false); day.setModel(new DefaultComboBoxModel()); result.setText(""); } } else { day.setEnabled(false); convert.setEnabled(false); day.setModel(new DefaultComboBoxModel()); result.setText(""); } }
From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilter.java
private void initMetaDataSearchTable() { metaDataSearchTable.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Metadata", "Operator", "Value", "Ignore Case" }) { public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == 3 && cachedMetaDataColumns.get(getValueAt(rowIndex, 0)) .getType() != MetaDataColumnType.STRING) { return false; }/*from w w w .j a va 2 s . c om*/ return true; } @Override public void setValueAt(Object value, int row, int column) { int metaDataColumnIndex = findColumn("Metadata"); int operatorColumnIndex = findColumn("Operator"); int valueColumnIndex = findColumn("Value"); int ignoreCaseColumnIndex = findColumn("Ignore Case"); if (column == valueColumnIndex) { MetaDataColumn metaDataColumn = cachedMetaDataColumns.get(getValueAt(row, metaDataColumnIndex)); if (StringUtils.isNotEmpty((String) value)) { try { metaDataColumn.getType().castValue(value); } catch (MetaDataColumnException e) { parent.alertError(parent, "Invalid value for column type " + metaDataColumn.getType().toString()); return; } } } else if (column == metaDataColumnIndex) { if (!value.equals(getValueAt(row, metaDataColumnIndex))) { MetaDataSearchOperator operator = MetaDataSearchOperator.EQUAL; super.setValueAt(operator, row, operatorColumnIndex); MetaDataColumn metaDataColumn = cachedMetaDataColumns.get(value); if (metaDataColumn.getType() != MetaDataColumnType.STRING) { super.setValueAt(Boolean.FALSE, row, ignoreCaseColumnIndex); } } super.setValueAt("", row, valueColumnIndex); } super.setValueAt(value, row, column); } }); metaDataSearchTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); metaDataSearchTable.setDragEnabled(false); metaDataSearchTable.setSortable(false); metaDataSearchTable.getTableHeader().setReorderingAllowed(false); addMetaDataSearchButton.setEnabled(!messageBrowser.getMetaDataColumns().isEmpty()); metaDataSearchTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { deleteMetaDataSearchButton.setEnabled(getSelectedRow(metaDataSearchTable) != -1); } }); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { metaDataSearchTable.setHighlighters(HighlighterFactory .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } List<MetaDataColumn> metaDataColumns = messageBrowser.getMetaDataColumns(); cachedMetaDataColumns.clear(); String[] metaDataNames = new String[metaDataColumns.size()]; for (int i = 0; i < metaDataColumns.size(); i++) { String columnName = metaDataColumns.get(i).getName(); metaDataNames[i] = columnName; cachedMetaDataColumns.put(columnName, metaDataColumns.get(i)); } MirthComboBoxTableCellEditor metaDataEditor = new MirthComboBoxTableCellEditor(metaDataSearchTable, metaDataNames, 1, false, null); metaDataEditor.getComboBox().setAutoResizeDropdown(true); TableColumn metaDataColumn = metaDataSearchTable.getColumnModel().getColumn(0); metaDataColumn.setCellRenderer(new MirthComboBoxTableCellRenderer(metaDataNames)); metaDataColumn.setCellEditor(metaDataEditor); metaDataColumn.setMinWidth(METADATA_NAME_COLUMN_WIDTH); metaDataColumn.setMaxWidth(METADATA_NAME_COLUMN_WIDTH * 2); metaDataColumn.setPreferredWidth(METADATA_NAME_COLUMN_WIDTH); // Need to create this custom editor since the combo box values are dynamic based on metadata column type. MirthComboBoxTableCellEditor operatorEditor = new MirthComboBoxTableCellEditor(metaDataSearchTable, MetaDataSearchOperator.values(), 1, false, null) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { MetaDataColumn metaDataColumn = cachedMetaDataColumns.get(table.getValueAt(row, 0)); comboBox.setModel(new DefaultComboBoxModel( MetaDataSearchOperator.valuesForColumnType(metaDataColumn.getType()))); return super.getTableCellEditorComponent(table, value, isSelected, row, column); } }; TableColumn operatorColumn = metaDataSearchTable.getColumnModel().getColumn(1); operatorColumn.setCellRenderer(new MirthComboBoxTableCellRenderer(MetaDataSearchOperator.values())); operatorColumn.setCellEditor(operatorEditor); operatorColumn.setMinWidth(METADATA_OPERATOR_COLUMN_WIDTH); operatorColumn.setMaxWidth(METADATA_OPERATOR_COLUMN_WIDTH); TableColumn caseColumn = metaDataSearchTable.getColumnModel().getColumn(3); caseColumn.setMinWidth(METADATA_CASE_COLUMN_WIDTH); caseColumn.setMaxWidth(METADATA_CASE_COLUMN_WIDTH); deleteMetaDataSearchButton.setEnabled(false); }
From source file:EditorPaneExample16.java
public void populateCombo(URL[] urls) { // Save existing selection Object o = urlCombo.getSelectedItem(); populatingCombo = true;//from ww w. j a v a2s .c o m urlCombo.setModel(new DefaultComboBoxModel(urls)); // Restore original selection urlCombo.setSelectedItem(o); populatingCombo = false; }
From source file:br.upe.ecomp.dosa.view.mainwindow.MainWindowActions.java
private void updateMeasurementBoxplotComboBox() { measurementsResultList = resultsAnalyzer.searchCommonsMeasurements(resultFiles); measurementResultComboBox.setModel(new DefaultComboBoxModel( measurementsResultList.toArray(new String[measurementsResultList.size()]))); measurementResultComboBox.setEnabled(true); }
From source file:com.cch.aj.entryrecorder.frame.SettingsJFrame.java
private void UpdateTabMachine(int id) { int selectedIndex = FillMachineComboBox(this.cbMachine, id); if (selectedIndex >= 0) { Machine currentMachine = ((ComboBoxItem<Machine>) this.cbMachine.getSelectedItem()).getItem(); this.txtMachineCapacity.setText(currentMachine.getCapacity()); this.txtMachineDesc.setText(currentMachine.getDescription()); this.txtMachineManufa.setText(currentMachine.getManufacturer()); this.txtMachineNo .setText(currentMachine.getMachineNo() != "- Select -" ? currentMachine.getMachineNo() : ""); this.txtMachineSerial.setText(currentMachine.getSerialNo()); this.txtMachineYear.setText(currentMachine.getYear()); } else {//from ww w .ja v a2 s. c o m this.cbMachine.setModel(new DefaultComboBoxModel(new ComboBoxItem[] {})); this.txtMachineCapacity.setText(""); this.txtMachineDesc.setText(""); this.txtMachineManufa.setText(""); this.txtMachineNo.setText(""); this.txtMachineSerial.setText(""); this.txtMachineYear.setText(""); } if (this.cbMachine.getSelectedItem() == null || ((ComboBoxItem<Machine>) this.cbMachine.getSelectedItem()).getId() == 0) { this.pnlEditMachine.setVisible(false); this.btnMachineDelete.setVisible(false); this.btnMachineSave.setVisible(false); this.btnMachineUndo.setVisible(false); } else { this.pnlEditMachine.setVisible(true); this.btnMachineDelete.setVisible(true); this.btnMachineSave.setVisible(true); this.btnMachineUndo.setVisible(true); } }
From source file:com.eviware.soapui.impl.wsdl.monitor.SoapMonitor.java
private JPanel buildFilterBar() { requestFilterModel = new DefaultComboBoxModel(new String[] { ALL_FILTER_OPTION }); targetHostFilterModel = new DefaultComboBoxModel(new String[] { ALL_FILTER_OPTION }); Dimension comboBoxSize = new Dimension(90, 18); requestHostFilterCombo = UISupport.setFixedSize(new JComboBox(requestFilterModel), comboBoxSize); // toolbar.addFixed( new JLabel( "<html><b>Filter:</b></html>")); // toolbar.addUnrelatedGap(); ButtonBarBuilder toolbar = new ButtonBarBuilder(); toolbar.addFixed(new JLabel("Request Host")); toolbar.addRelatedGap();//from w w w . j ava 2s . c o m toolbar.addFixed(requestHostFilterCombo); toolbar.addUnrelatedGap(); requestHostFilterCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { int ix = requestHostFilterCombo.getSelectedIndex(); if (ix == -1) return; requestHostFilter.setAcceptNull(ix == 0); if (ix == 0) requestHostFilter.setPattern(".*", 0); else requestHostFilter.setPattern(requestHostFilterCombo.getSelectedItem().toString(), 0); updateRowCountLabel(); } }); toolbar.addFixed(new JLabel("Target Host")); toolbar.addRelatedGap(); targetHostFilterCombo = UISupport.setFixedSize(new JComboBox(targetHostFilterModel), comboBoxSize); toolbar.addFixed(targetHostFilterCombo); toolbar.addUnrelatedGap(); targetHostFilterCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { int ix = targetHostFilterCombo.getSelectedIndex(); if (ix == -1) return; targetHostFilter.setAcceptNull(ix == 0); if (ix == 0) targetHostFilter.setPattern(".*", 0); else targetHostFilter.setPattern(targetHostFilterCombo.getSelectedItem().toString(), 0); updateRowCountLabel(); } }); String[] interfaceNames = ModelSupport.getNames(new String[] { ALL_FILTER_OPTION }, ModelSupport.getChildren(getProject(), WsdlInterface.class)); toolbar.addFixed(new JLabel("Interface")); toolbar.addRelatedGap(); interfaceFilterCombo = UISupport.setFixedSize(new JComboBox(interfaceNames), comboBoxSize); toolbar.addFixed(interfaceFilterCombo); toolbar.addUnrelatedGap(); operationFilterModel = new DefaultComboBoxModel(new String[] { ALL_FILTER_OPTION }); interfaceFilterCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { String item = (String) interfaceFilterCombo.getSelectedItem(); operationFilterModel.removeAllElements(); if (item == null || getProject().getInterfaceByName(item) == null) { operationFilterModel.addElement(ALL_FILTER_OPTION); interfaceFilter.setPattern(".*", 0); } else if (getProject().getInterfaceByName(item) != null) { WsdlInterface iface = (WsdlInterface) getProject().getInterfaceByName(item); String[] operationNames = ModelSupport.getNames(new String[] { ALL_FILTER_OPTION }, iface.getOperationList()); for (String s : operationNames) operationFilterModel.addElement(s); interfaceFilter.setPattern(iface.getName(), 0); } } }); toolbar.addFixed(new JLabel("Operation")); toolbar.addRelatedGap(); operationFilterCombo = UISupport.setFixedSize(new JComboBox(operationFilterModel), comboBoxSize); toolbar.addFixed(operationFilterCombo); operationFilterCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { int ix = operationFilterCombo.getSelectedIndex(); if (ix == -1) { operationFilter.setPattern(".*", 0); updateRowCountLabel(); return; } operationFilter.setAcceptNull(ix == 0); if (ix == 0) operationFilter.setPattern(".*", 0); else operationFilter.setPattern(operationFilterCombo.getSelectedItem().toString(), 0); updateRowCountLabel(); } }); toolbar.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 0)); return toolbar.getPanel(); }
From source file:net.openbyte.gui.CreateProjectFrame.java
private void comboBox1ItemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (comboBox1.getSelectedIndex() == 1) { // mcp if (!System.getProperty("os.name").startsWith("Windows")) { JOptionPane.showMessageDialog(this, "Python is required for MCP, please make sure you have Python installed.", "Notification", JOptionPane.INFORMATION_MESSAGE); }/*from www .jav a 2 s. c o m*/ String[] versions = new String[] { "1.9", "1.8.9", "1.7.10" }; DefaultComboBoxModel mcpModel = new DefaultComboBoxModel(versions); comboBox2.setModel(mcpModel); return; } if (comboBox1.getSelectedIndex() == 0) { // mcforge String[] versions = new String[] { "1.8.9", "1.7.10" }; DefaultComboBoxModel forgeModel = new DefaultComboBoxModel(versions); comboBox2.setModel(forgeModel); return; } if (((String) comboBox1.getSelectedItem()).equals("Bukkit")) { // bukkit JOptionPane.showMessageDialog(this, "Bukkit is solely ONLY the API, not the implementation!", "Notification", JOptionPane.INFORMATION_MESSAGE); String[] versions = new String[] { "1.9" }; DefaultComboBoxModel bukkitModel = new DefaultComboBoxModel(versions); comboBox2.setModel(bukkitModel); return; } } }
From source file:br.upe.ecomp.dosa.view.mainwindow.MainWindowActions.java
private void updateMeasurementLineComboBox() { measurementsResultList = resultsAnalyzer.searchCommonsMeasurements(resultFiles); measurementLineResultComboBox.setModel(new DefaultComboBoxModel( measurementsResultList.toArray(new String[measurementsResultList.size()]))); measurementLineResultComboBox.setEnabled(true); }
From source file:com.raddle.tools.MergeMain.java
private void initGUI() { try {// ww w.ja v a 2s.co m { this.setBounds(0, 0, 1050, 600); getContentPane().setLayout(null); this.setTitle("\u5c5e\u6027\u6587\u4ef6\u6bd4\u8f83"); { sourceTxt = new JTextField(); getContentPane().add(sourceTxt); sourceTxt.setBounds(12, 12, 373, 22); } { sourceBtn = new JButton(); getContentPane().add(sourceBtn); sourceBtn.setText("\u6253\u5f00"); sourceBtn.setBounds(406, 12, 74, 22); sourceBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(); // fileChooser.addChoosableFileFilter( new FileNameExtensionFilter("", "properties")); File curFile = new File(sourceTxt.getText()); if (curFile.exists()) { fileChooser.setCurrentDirectory(curFile.getParentFile()); } int result = fileChooser.showOpenDialog(MergeMain.this); if (result == JFileChooser.APPROVE_OPTION) { File selected = fileChooser.getSelectedFile(); source = new PropertyHolder(selected, "utf-8"); sourceTxt.setText(selected.getAbsolutePath()); properties.setProperty("left.file", selected.getAbsolutePath()); savePropMergeFile(); compare(); } } }); } { targetTxt = new JTextField(); getContentPane().add(targetTxt); targetTxt.setBounds(496, 12, 419, 22); } { targetBtn = new JButton(); getContentPane().add(targetBtn); targetBtn.setText("\u6253\u5f00"); targetBtn.setBounds(935, 12, 81, 22); targetBtn.setSize(74, 22); targetBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(); // fileChooser.addChoosableFileFilter( new FileNameExtensionFilter("", "properties")); File curFile = new File(targetTxt.getText()); if (curFile.exists()) { fileChooser.setCurrentDirectory(curFile.getParentFile()); } int result = fileChooser.showOpenDialog(MergeMain.this); if (result == JFileChooser.APPROVE_OPTION) { File selected = fileChooser.getSelectedFile(); target = new PropertyHolder(selected, "utf-8"); targetTxt.setText(selected.getAbsolutePath()); properties.setProperty("right.file", selected.getAbsolutePath()); savePropMergeFile(); compare(); } } }); } { jScrollPane1 = new JScrollPane(); getContentPane().add(jScrollPane1); jScrollPane1.setBounds(12, 127, 373, 413); { ListModel sourceListModel = new DefaultComboBoxModel(new String[] {}); sourceList = new JList(); jScrollPane1.setViewportView(sourceList); sourceList.setAutoscrolls(true); sourceList.setModel(sourceListModel); sourceList.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_DELETE) { PropertyLine v = (PropertyLine) sourceList.getSelectedValue(); if (v != null) { int ret = JOptionPane.showConfirmDialog(MergeMain.this, "?" + v.getKey() + "?"); if (ret == JOptionPane.YES_OPTION) { v.setState(LineState.deleted); compare(); sourceList.setSelectedValue(v, true); } } } } }); sourceList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { if (evt.getClickCount() == 2) { Object v = sourceList.getSelectedValue(); updatePropertyLine((PropertyLine) v); sourceList.setSelectedValue(v, true); } } }); sourceList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (sourceList.getSelectedValue() != null) { PropertyLine pl = (PropertyLine) sourceList.getSelectedValue(); if (target != null) { PropertyLine p = target.getLine(pl.getKey()); if (p != null) { TextDiffResult rt = TextdiffUtil.getDifferResult(p.toString(), pl.toString()); diffResultPane.setText("" + rt.getTargetHtml() + "<br/>?" + rt.getSrcHtml()); selectLine(targetList, p); return; } } TextDiffResult rt = TextdiffUtil.getDifferResult("", pl.toString()); diffResultPane.setText( "" + rt.getTargetHtml() + "<br/>?" + rt.getSrcHtml()); } } }); } } { jScrollPane2 = new JScrollPane(); getContentPane().add(jScrollPane2); jScrollPane2.setBounds(496, 127, 419, 413); { ListModel targetListModel = new DefaultComboBoxModel(new String[] {}); targetList = new JList(); jScrollPane2.setViewportView(targetList); targetList.setAutoscrolls(true); targetList.setModel(targetListModel); targetList.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_DELETE) { PropertyLine v = (PropertyLine) targetList.getSelectedValue(); if (v != null) { int ret = JOptionPane.showConfirmDialog(MergeMain.this, "?" + v.getKey() + "?"); if (ret == JOptionPane.YES_OPTION) { v.setState(LineState.deleted); compare(); targetList.setSelectedValue(v, true); } } } } }); targetList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { if (evt.getClickCount() == 2) { Object v = targetList.getSelectedValue(); updatePropertyLine((PropertyLine) v); targetList.setSelectedValue(v, true); } } }); targetList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (targetList.getSelectedValue() != null) { PropertyLine pl = (PropertyLine) targetList.getSelectedValue(); if (source != null) { PropertyLine s = source.getLine(pl.getKey()); if (s != null) { TextDiffResult rt = TextdiffUtil.getDifferResult(pl.toString(), s.toString()); diffResultPane.setText("" + rt.getTargetHtml() + "<br/>?" + rt.getSrcHtml()); selectLine(sourceList, s); return; } } TextDiffResult rt = TextdiffUtil.getDifferResult(pl.toString(), ""); diffResultPane.setText( "" + rt.getTargetHtml() + "<br/>?" + rt.getSrcHtml()); } } }); } } { sourceSaveBtn = new JButton(); getContentPane().add(sourceSaveBtn); sourceSaveBtn.setText("\u4fdd\u5b58"); sourceSaveBtn.setBounds(406, 45, 74, 22); sourceSaveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { int result = JOptionPane.showConfirmDialog(MergeMain.this, "???\n" + source.getPropertyFile().getAbsolutePath()); if (result == JOptionPane.YES_OPTION) { source.saveFile(); JOptionPane.showMessageDialog(MergeMain.this, "??"); clearState(source); compare(); } } }); } { targetSaveBtn = new JButton(); getContentPane().add(targetSaveBtn); targetSaveBtn.setText("\u4fdd\u5b58"); targetSaveBtn.setBounds(935, 45, 81, 22); targetSaveBtn.setSize(74, 22); targetSaveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { int result = JOptionPane.showConfirmDialog(MergeMain.this, "????\n" + target.getPropertyFile().getAbsolutePath()); if (result == JOptionPane.YES_OPTION) { target.saveFile(); JOptionPane.showMessageDialog(MergeMain.this, "??"); clearState(target); compare(); } } }); } { toTargetBtn = new JButton(); getContentPane().add(toTargetBtn); toTargetBtn.setText("->"); toTargetBtn.setBounds(406, 221, 74, 22); toTargetBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { Object[] oo = sourceList.getSelectedValues(); for (Object selected : oo) { PropertyLine s = (PropertyLine) selected; if (s != null && target != null) { PropertyLine t = target.getLine(s.getKey()); if (t == null) { PropertyLine n = s.clone(); n.setState(LineState.added); target.addPropertyLineAtSuitedPosition(n); } else if (!t.getValue().equals(s.getValue())) { t.setState(LineState.updated); t.setValue(s.getValue()); } else if (t.getState() == LineState.deleted) { if (t.getValue().equals(t.getOriginalValue())) { t.setState(LineState.original); } else { t.setState(LineState.updated); } } compare(); } } } }); } { toSourceBtn = new JButton(); getContentPane().add(toSourceBtn); toSourceBtn.setText("<-"); toSourceBtn.setBounds(406, 255, 74, 22); toSourceBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { Object[] oo = targetList.getSelectedValues(); for (Object selected : oo) { PropertyLine t = (PropertyLine) selected; if (t != null && source != null) { PropertyLine s = source.getLine(t.getKey()); if (s == null) { PropertyLine n = t.clone(); n.setState(LineState.added); source.addPropertyLineAtSuitedPosition(n); } else if (!s.getValue().equals(t.getValue())) { s.setState(LineState.updated); s.setValue(t.getValue()); } else if (s.getState() == LineState.deleted) { if (s.getValue().equals(s.getOriginalValue())) { s.setState(LineState.original); } else { s.setState(LineState.updated); } } compare(); } } } }); } { jScrollPane3 = new JScrollPane(); getContentPane().add(jScrollPane3); jScrollPane3.setBounds(12, 73, 903, 42); { diffResultPane = new JTextPane(); jScrollPane3.setViewportView(diffResultPane); diffResultPane.setBounds(12, 439, 903, 63); diffResultPane.setContentType("text/html"); diffResultPane.setPreferredSize(new java.awt.Dimension(901, 42)); } } { compareBtn = new JButton(); getContentPane().add(compareBtn); compareBtn.setText("\u6bd4\u8f83"); compareBtn.setBounds(406, 139, 74, 22); compareBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { compare(); } }); } { sourceReloadBtn = new JButton(); getContentPane().add(sourceReloadBtn); sourceReloadBtn.setText("\u91cd\u65b0\u8f7d\u5165"); sourceReloadBtn.setBounds(12, 40, 64, 29); sourceReloadBtn.setSize(90, 22); sourceReloadBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if (sourceTxt.getText().length() > 0) { File curFile = new File(sourceTxt.getText().trim()); if (curFile.exists()) { source = new PropertyHolder(curFile, "utf-8"); sourceTxt.setText(curFile.getAbsolutePath()); properties.setProperty("left.file", curFile.getAbsolutePath()); savePropMergeFile(); compare(); } else { JOptionPane.showMessageDialog(MergeMain.this, "" + curFile.getAbsolutePath() + "?"); } } } }); } { targetReloadBtn = new JButton(); getContentPane().add(targetReloadBtn); targetReloadBtn.setText("\u91cd\u65b0\u8f7d\u5165"); targetReloadBtn.setBounds(839, 45, 90, 22); targetReloadBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if (targetTxt.getText().length() > 0) { File curFile = new File(targetTxt.getText().trim()); if (curFile.exists()) { target = new PropertyHolder(curFile, "utf-8"); targetTxt.setText(curFile.getAbsolutePath()); properties.setProperty("right.file", curFile.getAbsolutePath()); savePropMergeFile(); compare(); } else { JOptionPane.showMessageDialog(MergeMain.this, "" + curFile.getAbsolutePath() + "?"); } } } }); } { helpBtn = new JButton(); getContentPane().add(helpBtn); helpBtn.setText("\u5e2e\u52a9"); helpBtn.setBounds(405, 338, 38, 29); helpBtn.setSize(74, 22); helpBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { StringBuilder sb = new StringBuilder(); sb.append("?").append("\n"); sb.append("del").append("\n"); sb.append("??").append("\n"); sb.append(": /.prop-merge/prop-merge.properties").append("\n"); JOptionPane.showMessageDialog(MergeMain.this, sb.toString()); } }); } { sourceEditBtn = new JButton(); getContentPane().add(sourceEditBtn); sourceEditBtn.setText("\u7f16\u8f91\u6587\u4ef6"); sourceEditBtn.setBounds(108, 40, 90, 22); sourceEditBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if (sourceTxt.getText().length() > 0) { File curFile = new File(sourceTxt.getText()); editFile(curFile); } } }); } { targetEditBtn = new JButton(); getContentPane().add(targetEditBtn); targetEditBtn.setText("\u7f16\u8f91\u6587\u4ef6"); targetEditBtn.setBounds(743, 45, 90, 22); targetEditBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { if (targetTxt.getText().length() > 0) { File curFile = new File(targetTxt.getText()); editFile(curFile); } } }); } } pack(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.projity.reports.view.ReportView.java
private void initColumns() { String ssFields = reportDefinition.getMainSpreadsheetCategory(); if (ssFields == null || ssFields.equals("assignmentSpreadsheet")) { //$NON-NLS-1$ columnsChoice.setVisible(false); columnsLabel.setVisible(false);// ww w .jav a2s .c om return; } columnsChoice.setVisible(true); columnsLabel.setVisible(true); DefaultComboBoxModel model = new DefaultComboBoxModel(Dictionary.getAll(ssFields)); columnsChoice.setModel(model); columnsChoice.setSelectedItem(fieldArray); }