/** * This method creates the command selection panel. * * @return command selection panel */ private JPanel createCommandSelectionPanel() { JPanel selectionPanel = new JPanel(); selectionPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(guiText.getString("SelectionPanelTitle")), BorderFactory.createEmptyBorder(5, 5, 5, 5))); commandSelection.setMaximumRowCount(12); commandSelection.addItem(null); for (String item : getCommands()) { commandSelection.addItem(item); } commandSelection.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if ("comboBoxChanged".equals(e.getActionCommand())) { setCommandPanel(commandSelection.getSelectedIndex()); } } }); selectionPanel.add(commandSelection); return selectionPanel; }
public JPanel buildStrategySelectionPanel(Window aParentContainer, Atdl4jOptions atdl4jOptions) { setAtdl4jOptions(atdl4jOptions); JPanel panel = new JPanel(new BorderLayout()); // label JLabel strategiesDropDownLabel = new JLabel("Strategy"); panel.add(strategiesDropDownLabel, BorderLayout.WEST); // dropDownList strategiesDropDown = new JComboBox(); strategiesDropDown.setEditable(false); panel.add(strategiesDropDown, BorderLayout.CENTER); if (Atdl4jConfig.getConfig().getStrategyDropDownItemDepth() != null) { strategiesDropDown.setMaximumRowCount( Atdl4jConfig.getConfig().getStrategyDropDownItemDepth().intValue()); } // tooltip strategiesDropDown.setToolTipText("Select a Strategy"); // action listener strategiesDropDown.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int index = strategiesDropDown.getSelectedIndex(); selectDropDownStrategy(index); } } }); return panel; }
public EmployeeCUDialog(JFrame owner, String title) { super(owner); this.setTitle(title); this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.setLocation(500, 250); this.setSize(200, 300); this.setLayout(null); this.setModal(true); lblName = new JLabel("Name:"); this.add(lblName); lblName.setLocation(20, 10); lblName.setSize(100, 25); txfName = new JTextField(); this.add(txfName); txfName.setLocation(20, 35); txfName.setSize(150, 25); lblWage = new JLabel("Wage:"); this.add(lblWage); lblWage.setLocation(20, 70); lblWage.setSize(100, 25); txfWage = new JTextField(); this.add(txfWage); txfWage.setLocation(20, 95); txfWage.setSize(150, 25); lblCompany = new JLabel("Company:"); this.add(lblCompany); lblCompany.setLocation(20, 130); lblCompany.setSize(100, 25); cbxCompanies = new JComboBox<Company>(); this.add(cbxCompanies); cbxCompanies.setLocation(20, 155); cbxCompanies.setSize(150, 25); cbxCompanies.setMaximumRowCount(4); btnOk = new JButton("Ok"); this.add(btnOk); btnOk.setLocation(15, 225); btnOk.setSize(70, 25); btnOk.addActionListener(controller); btnCancel = new JButton("Cancel"); this.add(btnCancel); btnCancel.setLocation(95, 225); btnCancel.setSize(80, 25); btnCancel.addActionListener(controller); // initialise this view controller.fillCbxCompanies(); }
public LibraryManagerUI(Frame parent, Platform platform) { super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues.")); this.platform = platform; filtersContainer.add(new JLabel(_("Topic")), 1); filtersContainer.remove(2); typeChooser = new JComboBox(); typeChooser.setMaximumRowCount(20); typeChooser.setEnabled(false); filtersContainer.add(Box.createHorizontalStrut(5), 0); filtersContainer.add(new JLabel(_("Type")), 1); filtersContainer.add(Box.createHorizontalStrut(5), 2); filtersContainer.add(typeChooser, 3); }
private JComboBox setupTypeCB(JComboBox box) { String Descritpions[] = new String[LogTypeHelper.values().length]; int t = 0; for (LogTypeHelper log : LogTypeHelper.values()) { Descritpions[t++] = log.logEntryType; } JComboBox logLevelCB = new JComboBox(Descritpions); // Build the renderer for the combo boxesx LogTypeRenderer rendererCB = new LogTypeRenderer(); logLevelCB.setEditable(false); logLevelCB.setMaximumRowCount(LogTypeHelper.values().length); logLevelCB.setRenderer(rendererCB); return logLevelCB; }
/** Creates new form gui */ public gui() { super(new BorderLayout()); initComponents(); // Load user list and images images = new ImageIcon[userStrings.length]; Integer[] intArray = new Integer[userStrings.length]; for (int i = 0; i < userStrings.length; i++) { intArray[i] = new Integer(i); images[i] = createImageIcon("images/" + userStrings[i] + ".png"); if (images[i] != null) { images[i].setDescription(userStrings[i]); } } users = new JComboBox(intArray); Color bg = (Color) UIManager.get("ComboBox.background"); Color fg = (Color) UIManager.get("ComboBox.foreground"); UIManager.put("ComboBox.selectionBackground", bg); UIManager.put("ComboBox.selectionForeground", fg); users.setUI(new MetalComboBoxUI()); // ComboBoxRenderer renderer = new ComboBoxRenderer(); ComboBoxRenderer renderer = new ComboBoxRenderer(userStrings, images); renderer.setPreferredSize(new Dimension(650, 150)); users.setRenderer(renderer); users.setSize(renderer.getPreferredSize()); users.setMaximumRowCount(4); users.setBounds(150, 250, 650, 200); add(users); // setBorder(BorderFactory.createEmptyBorder(20,20,20,20)); // Set the user satisfaction labels jSlider1.setPaintTicks(true); Hashtable labelTable = new Hashtable(); for (int i = 0; i < labels.length; i++) { labelTable.put(new Integer(i), new JLabel(labels[i])); } jSlider1.setLabelTable(labelTable); jSlider1.setPaintLabels(true); socket = new generalSocket(machine, 1099); statusThread thread = new statusThread(socket, jLabel4); Thread theThread = new Thread(thread); theThread.start(); }
public FindProf() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); // Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Search your campus!"); JLabel patternLabel2 = new JLabel(""); patternList = new JComboBox<Object>(searchNames); patternList.setEditable(true); patternList.setMaximumRowCount(5); patternList.addActionListener(this); // Create the UI for displaying result. JLabel resultLabel = new JLabel("Building Initials & Room Number:", JLabel.LEADING); // == LEFT result = new JLabel(" "); result.setHorizontalAlignment(SwingConstants.CENTER); result.setForeground(Color.black); result.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Lay out everything. JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); patternPanel.add(patternList); JPanel resultPanel = new JPanel(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT); resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternPanel); add(Box.createRigidArea(new Dimension(0, 10))); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); } // constructor
public FocusURNSelectBox() { super(BoxLayout.LINE_AXIS); setMaximumSize(new Dimension(width, 40)); setSize(width, 40); ArrayList<JComponent> boxList = new ArrayList<JComponent>() { @Override public boolean add(JComponent c) { // ボックスにする Box box = Box.createHorizontalBox(); box.setMaximumSize(c.getSize()); box.setSize(c.getSize()); box.add(c); return super.add(box); } }; final JLabel nameLabel = new JLabel("FocusEntityURN"); nameLabel.setSize(width / 4, 40); nameLabel.setMaximumSize(new Dimension(width * 2 / 8, 24)); boxList.add(nameLabel); Vector<String> items = new Vector<String>(); strToURN = new HashMap<String, StandardEntityURN>(); items.add("Null"); for (StandardEntityURN urn : Viewer.INDEX_CLASS) { strToURN.put(urn.name(), urn); items.add(urn.name()); } Collections.sort(items); urnComboBox = new JComboBox(items); urnComboBox.setSize(width * 3 / 4, 24); urnComboBox.setMaximumRowCount(Viewer.INDEX_CLASS.length); urnComboBox.addItemListener(this); boxList.add(urnComboBox); urnComboBox.setSelectedItem("Null"); for (JComponent c : boxList) { add(c); } }
/** * Overridden to create a new title year component. * * @return */ protected JComponent createTitleYear() { yearTitleComboBox = new JComboBox(); yearTitleComboBox.setEditable(true); yearTitleComboBox.setPreferredSize( new Dimension(50, yearTitleComboBox.getPreferredSize().height)); yearTitleComboBox.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { Integer value = (Integer) yearTitleComboBox.getSelectedItem(); month.setYear(value.intValue()); } }); yearTitleComboBox.setModel(new YearComboBoxModel(10)); yearTitleComboBox.setMaximumRowCount(10); yearTitleComboBox.setSelectedItem(new Integer(month.getYear())); ((JTextField) yearTitleComboBox.getEditor().getEditorComponent()).setColumns(5); return yearTitleComboBox; }
/** * Overriden to create a new title month component. * * @return a combo box with all the months of the year. */ protected JComponent createTitleMonth() { monthTitleComboBox = new JComboBox( new Integer[] { new Integer(Calendar.JANUARY), new Integer(Calendar.FEBRUARY), new Integer(Calendar.MARCH), new Integer(Calendar.APRIL), new Integer(Calendar.MAY), new Integer(Calendar.JUNE), new Integer(Calendar.JULY), new Integer(Calendar.AUGUST), new Integer(Calendar.SEPTEMBER), new Integer(Calendar.OCTOBER), new Integer(Calendar.NOVEMBER), new Integer(Calendar.DECEMBER) }); monthTitleComboBox.setRenderer( new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); int m = ((Integer) value).intValue(); label.setText(month.getMonthModel().getMonthNames()[m]); return label; } }); monthTitleComboBox.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { month.setMonth(((Integer) monthTitleComboBox.getSelectedItem()).intValue()); } }); monthTitleComboBox.setSelectedItem(new Integer(month.getMonth())); monthTitleComboBox.setMaximumRowCount(12); return monthTitleComboBox; }
protected void addMyControls() { // add browser-style control buttons JButton home = new JButton(new ImageIcon("data/Home24.gif")); JButton back = new JButton(new ImageIcon("data/Back24.gif")); JButton fwd = new JButton(new ImageIcon("data/Forward24.gif")); home.setToolTipText("Home"); home.addActionListener(this); home.setActionCommand(homeCmd); back.setToolTipText("Back"); back.addActionListener(this); back.setActionCommand(backCmd); back.setEnabled(false); // initially disabled fwd.setToolTipText("Forward"); fwd.addActionListener(this); fwd.setActionCommand(forwardCmd); fwd.setEnabled(false); // initially disabled add(home); add(back); add(fwd); add(new JToolBar.Separator()); // set built-in index variables homeIndex = getComponentIndex(home); backIndex = getComponentIndex(back); forwardIndex = getComponentIndex(fwd); JComboBox comboBox = new JComboBox(); comboBox.setEditable(true); comboBox.addActionListener(this); comboBox.setActionCommand(comboCmd); comboBox.setMaximumRowCount(3); // don't let it get too long comboBox.insertItemAt(mainBrowserURL, 0); // don't start it out empty add(comboBox); comboBoxIndex = getComponentIndex(comboBox); }
protected void initComboChangeMethod() { if (comboChangeMethod == null) { comboChangeMethod = new JComboBox<>(); comboChangeMethod.setEditable(false); comboChangeMethod.setMaximumRowCount(9); // Prevents scrollbar comboChangeMethod.addItem(Constant.messages.getString("manReq.pullDown.method")); comboChangeMethod.addItem(HttpRequestHeader.CONNECT); comboChangeMethod.addItem(HttpRequestHeader.DELETE); comboChangeMethod.addItem(HttpRequestHeader.GET); comboChangeMethod.addItem(HttpRequestHeader.HEAD); comboChangeMethod.addItem(HttpRequestHeader.OPTIONS); comboChangeMethod.addItem(HttpRequestHeader.POST); comboChangeMethod.addItem(HttpRequestHeader.PUT); comboChangeMethod.addItem(HttpRequestHeader.TRACE); comboChangeMethod.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (message == null) { comboChangeMethod.setSelectedIndex(0); return; } if (comboChangeMethod.getSelectedIndex() > 0) { if (message instanceof HttpMessage) { saveData(); ((HttpMessage) message) .mutateHttpMethod((String) comboChangeMethod.getSelectedItem()); comboChangeMethod.setSelectedIndex(0); updateContent(); } } } }); addOptions(comboChangeMethod, OptionsLocation.BEGIN); comboChangeMethod.setEnabled(false); } }
private void createComponents() { categoryLabel = new JLabel(Language.text("contrib.category")); categoryChooser = new JComboBox<String>(); categoryChooser.setMaximumRowCount(20); categoryChooser.setFont(Toolkit.getSansFont(14, Font.PLAIN)); updateCategoryChooser(); categoryChooser.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { category = (String) categoryChooser.getSelectedItem(); if (ContributionManagerDialog.ANY_CATEGORY.equals(category)) { category = null; } filterLibraries(category, filterField.filters); contributionListPanel.updateColors(); } }); filterField = new FilterField(); }
public MirthComboBoxTableCellEditor( JTable table, Object[] items, int clickCount, boolean focusable, final ActionListener actionListener) { this.clickCount = clickCount; comboBox = new JComboBox(items); comboBox.setFocusable(focusable); comboBox.setMaximumRowCount(20); comboBox.setForeground(table.getForeground()); comboBox.setBackground(table.getBackground()); comboBox.setRenderer(new DataTypeListCellRenderer()); // Allow an action listener to be passed in. However, we need to fireEditingStopped after the // action has finished so we wrap it in another listener comboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (actionListener != null) { actionListener.actionPerformed(e); } fireEditingStopped(); } }); // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4515838 // Workaround to remove the border around the comboBox for (int i = 0; i < comboBox.getComponentCount(); i++) { if (comboBox.getComponent(i) instanceof AbstractButton) { ((AbstractButton) comboBox.getComponent(i)).setBorderPainted(false); } } }
private void initStart() { // setResizable(false); setLayout(null); jlb = new JLabel("참여 인원수를 선택하세요"); jlb.setBounds(7, 7, 160, 20); jcb = new JComboBox(); for (int i = 2; i <= 10; i++) jcb.addItem(i); jcb.setSelectedItem(6); jcb.setMaximumRowCount(9); jcb.setBounds(50, 34, 70, 20); start_bt = new JButton("Start"); start_bt.setBounds(45, 62, 80, 30); con.add(jlb); con.add(start_bt); con.add(jcb); start_bt.addActionListener(this); jcb.addActionListener(this); setVisible(true); }
public Container createFontBox() { final JComboBox fontsBox = new JComboBox(fonts); fontsBox.setMaximumRowCount(9); fontsBox.setRenderer(new ComboBoxRendererWithTooltip(fontsBox)); return fontsBox; }
public void initComponents() { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); TestbedSettings settings = model.getSettings(); JPanel top = new JPanel(); top.setLayout(new GridLayout(0, 1)); top.setBorder( BorderFactory.createCompoundBorder( new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(10, 10, 10, 10))); tests = new JComboBox(model.getComboModel()); tests.setMaximumRowCount(30); tests.setMaximumSize(new Dimension(250, 20)); tests.addActionListener(this); tests.setRenderer( new ListCellRenderer() { JLabel categoryLabel = null; JLabel testLabel = null; @Override public Component getListCellRendererComponent( JList list, Object ovalue, int index, boolean isSelected, boolean cellHasFocus) { ListItem value = (ListItem) ovalue; if (value.isCategory()) { if (categoryLabel == null) { categoryLabel = new JLabel(); categoryLabel.setOpaque(true); categoryLabel.setBackground(new Color(.5f, .5f, .6f)); categoryLabel.setForeground(Color.white); categoryLabel.setHorizontalAlignment(SwingConstants.CENTER); categoryLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); } categoryLabel.setText(value.category); return categoryLabel; } else { if (testLabel == null) { testLabel = new JLabel(); testLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 1, 0)); } testLabel.setText(value.test.getTestName()); if (isSelected) { testLabel.setBackground(list.getSelectionBackground()); testLabel.setForeground(list.getSelectionForeground()); } else { testLabel.setBackground(list.getBackground()); testLabel.setForeground(list.getForeground()); } return testLabel; } } }); top.add(new JLabel("Choose a test:")); top.add(tests); addSettings(top, settings, SettingType.DRAWING); add(top, "North"); JPanel middle = new JPanel(); middle.setLayout(new GridLayout(0, 1)); middle.setBorder( BorderFactory.createCompoundBorder( new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5, 10, 5, 10))); addSettings(middle, settings, SettingType.ENGINE); add(middle, "Center"); pauseButton.setAlignmentX(CENTER_ALIGNMENT); stepButton.setAlignmentX(CENTER_ALIGNMENT); resetButton.setAlignmentX(CENTER_ALIGNMENT); saveButton.setAlignmentX(CENTER_ALIGNMENT); loadButton.setAlignmentX(CENTER_ALIGNMENT); quitButton.setAlignmentX(CENTER_ALIGNMENT); Box buttonGroups = Box.createHorizontalBox(); JPanel buttons1 = new JPanel(); buttons1.setLayout(new GridLayout(0, 1)); buttons1.add(resetButton); JPanel buttons2 = new JPanel(); buttons2.setLayout(new GridLayout(0, 1)); buttons2.add(pauseButton); buttons2.add(stepButton); JPanel buttons3 = new JPanel(); buttons3.setLayout(new GridLayout(0, 1)); buttons3.add(saveButton); buttons3.add(loadButton); buttons3.add(quitButton); buttonGroups.add(buttons1); buttonGroups.add(buttons2); buttonGroups.add(buttons3); add(buttonGroups, "South"); }
/** * Create a choicebox for link line style options and return the panel it is in. * * @return JPanel the panel holding the new choicebox for the link style options. */ private JPanel createLinkDashedChoiceBox() { JPanel drawPanel = new JPanel(new BorderLayout()); CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$ cbLinkDashed = new JComboBox(); cbLinkDashed.setToolTipText( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectDashed")); // $NON-NLS-1$ cbLinkDashed.setOpaque(true); cbLinkDashed.setEditable(false); cbLinkDashed.setEnabled(false); cbLinkDashed.setMaximumRowCount(10); cbLinkDashed.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$ cbLinkDashed.addItem( new String( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.plainLine"))); //$NON-NLS-1$ cbLinkDashed.addItem( new String( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.largeDashes"))); //$NON-NLS-1$ cbLinkDashed.addItem( new String( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.smallDashes"))); //$NON-NLS-1$ cbLinkDashed.validate(); cbLinkDashed.setSelectedIndex(0); DefaultListCellRenderer drawRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) { if (list != null) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } } setText((String) value); return this; } }; cbLinkDashed.setRenderer(drawRenderer); ActionListener drawActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { onUpdateLinkDashed(cbLinkDashed.getSelectedIndex()); } }; cbLinkDashed.addActionListener(drawActionListener); drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$ drawPanel.add(cbLinkDashed, BorderLayout.CENTER); return drawPanel; }
/** * Create a choicbox for link line thickness options and return the panel it is in. * * @return JPanel the panel holding the new choicebox for the line thickness options. */ private JPanel createWeightChoiceBox() { JPanel drawPanel = new JPanel(new BorderLayout()); CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$ cbLineWeight = new JComboBox(); cbLineWeight.setToolTipText( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectWeight")); // $NON-NLS-1$ cbLineWeight.setOpaque(true); cbLineWeight.setEditable(false); cbLineWeight.setEnabled(false); cbLineWeight.setMaximumRowCount(10); cbLineWeight.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$ cbLineWeight.addItem(new String("1 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("2 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("3 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("4 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("5 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("6 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("7 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("8 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("9 px")); // $NON-NLS-1$ cbLineWeight.addItem(new String("10 px")); // $NON-NLS-1$ cbLineWeight.validate(); cbLineWeight.setSelectedIndex(0); DefaultListCellRenderer drawRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) { if (list != null) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } } setText((String) value); return this; } }; cbLineWeight.setRenderer(drawRenderer); ActionListener drawActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { int ind = cbLineWeight.getSelectedIndex(); if (ind == 0) onUpdateLinkWeight(1); else if (ind == 1) onUpdateLinkWeight(2); else if (ind == 2) onUpdateLinkWeight(3); else if (ind == 3) onUpdateLinkWeight(4); else if (ind == 4) onUpdateLinkWeight(5); else if (ind == 5) onUpdateLinkWeight(6); else if (ind == 6) onUpdateLinkWeight(7); else if (ind == 7) onUpdateLinkWeight(8); else if (ind == 8) onUpdateLinkWeight(9); else if (ind == 9) onUpdateLinkWeight(10); } }; cbLineWeight.addActionListener(drawActionListener); drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$ drawPanel.add(cbLineWeight, BorderLayout.CENTER); return drawPanel; }
/** Create the arrow head choicebox. */ private JPanel createArrowChoiceBox() { JPanel drawPanel = new JPanel(new BorderLayout()); CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$ cbArrows = new JComboBox(); cbArrows.setToolTipText( LanguageProperties.getString( LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectArrow")); // $NON-NLS-1$ cbArrows.setOpaque(true); cbArrows.setEditable(false); cbArrows.setEnabled(false); cbArrows.setMaximumRowCount(4); cbArrows.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$ Vector arrows = new Vector(5); arrows.insertElementAt( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.noArrows"), 0); //$NON-NLS-1$ arrows.insertElementAt( LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.fromTo"), 1); //$NON-NLS-1$ arrows.insertElementAt( LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.toFfrom"), 2); //$NON-NLS-1$ arrows.insertElementAt( LanguageProperties.getString( LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.bothWays"), 3); //$NON-NLS-1$ DefaultComboBoxModel comboModel = new DefaultComboBoxModel(arrows); cbArrows.setModel(comboModel); cbArrows.setSelectedIndex(0); DefaultListCellRenderer comboRenderer = new DefaultListCellRenderer() { public Component getListCellRendererComponent( JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setText((String) value); return this; } }; cbArrows.setRenderer(comboRenderer); cbArrows.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { onUpdateArrowType(cbArrows.getSelectedIndex()); } }); drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$ drawPanel.add(cbArrows, BorderLayout.CENTER); return drawPanel; }
public JPanel getWindowLevelPanel() { final JPanel winLevelPanel = new JPanel(); winLevelPanel.setAlignmentY(Component.TOP_ALIGNMENT); winLevelPanel.setAlignmentX(Component.LEFT_ALIGNMENT); winLevelPanel.setLayout(new BoxLayout(winLevelPanel, BoxLayout.Y_AXIS)); winLevelPanel.setBorder( BorderFactory.createCompoundBorder( spaceY, new TitledBorder( null, Messages.getString("ImageTool.wl"), // $NON-NLS-1$ TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, TITLE_FONT, TITLE_COLOR))); ActionState winAction = EventManager.getInstance().getAction(ActionW.WINDOW); if (winAction instanceof SliderChangeListener) { final JSliderW windowSlider = ((SliderChangeListener) winAction).createSlider(4, true); // windowSlider.setMajorTickSpacing((largestWindow - smallestWindow) / 4); JMVUtils.setPreferredWidth(windowSlider, 100); winLevelPanel.add(windowSlider.getParent()); } ActionState levelAction = EventManager.getInstance().getAction(ActionW.LEVEL); if (levelAction instanceof SliderChangeListener) { final JSliderW levelSlider = ((SliderChangeListener) levelAction).createSlider(4, true); levelSlider.setMajorTickSpacing( (ImageViewerEventManager.LEVEL_LARGEST - ImageViewerEventManager.LEVEL_SMALLEST) / 4); JMVUtils.setPreferredWidth(levelSlider, 100); winLevelPanel.add(levelSlider.getParent()); } ActionState presetAction = EventManager.getInstance().getAction(ActionW.PRESET); if (presetAction instanceof ComboItemListener) { final JPanel panel_3 = new JPanel(); panel_3.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 3)); final JLabel presetsLabel = new JLabel(); panel_3.add(presetsLabel); presetsLabel.setText( Messages.getString("ImageTool.preset") + StringUtil.COLON); // $NON-NLS-1$ final JComboBox presetComboBox = ((ComboItemListener) presetAction).createCombo(160); presetComboBox.setMaximumRowCount(10); panel_3.add(presetComboBox); winLevelPanel.add(panel_3); } ActionState lutAction = EventManager.getInstance().getAction(ActionW.LUT); if (lutAction instanceof ComboItemListener) { final JPanel panel_4 = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 3)); final JLabel lutLabel = new JLabel(); lutLabel.setText(Messages.getString("ImageTool.lut") + StringUtil.COLON); // $NON-NLS-1$ panel_4.add(lutLabel); final JComboBox lutcomboBox = ((ComboItemListener) lutAction).createCombo(140); panel_4.add(lutcomboBox); ActionState invlutAction = EventManager.getInstance().getAction(ActionW.INVERT_LUT); if (invlutAction instanceof ToggleButtonListener) { panel_4.add( ((ToggleButtonListener) invlutAction) .createCheckBox(Messages.getString("ImageTool.inverse"))); // $NON-NLS-1$ } winLevelPanel.add(panel_4); } ActionState filterAction = EventManager.getInstance().getAction(ActionW.FILTER); if (filterAction instanceof ComboItemListener) { final JPanel panel_4 = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 3)); final JLabel lutLabel = new JLabel(); lutLabel.setText(Messages.getString("ImageTool.filter")); // $NON-NLS-1$ panel_4.add(lutLabel); final JComboBox filtercomboBox = ((ComboItemListener) filterAction).createCombo(160); panel_4.add(filtercomboBox); winLevelPanel.add(panel_4); } return winLevelPanel; }
public BurtgehHuudas() { super("Бүртгэл хуудас"); Container con = getContentPane(); con.setLayout(null); // haryalagdah tenhim JLabel lbl1 = new JLabel("Харъяалагдах тэнхим:"); lbl1.setLocation(30, 30); lbl1.setSize(200, 30); con.add(lbl1); JComboBox combo1 = new JComboBox(); try { String s = "SELECT * FROM tenhim"; ResultSet rs = DatabaseTools.runQuery(s); while (rs.next()) { combo1.addItem(rs.getString(2)); } } catch (Exception e) { } combo1.setLocation(200, 30); combo1.setSize(200, 30); con.add(combo1); JLabel lb1 = new JLabel("Сонгоно уу?"); lb1.setLocation(450, 30); lb1.setSize(200, 30); con.add(lb1); // oyutanii code JLabel lbl2 = new JLabel("Код:"); lbl2.setLocation(30, 70); lbl2.setSize(200, 30); con.add(lbl2); JTextField txt1 = new JTextField(); txt1.setLocation(200, 70); txt1.setSize(200, 30); con.add(txt1); JLabel lb2 = new JLabel("Жишээ нь:SW001"); lb2.setLocation(450, 70); lb2.setSize(200, 30); con.add(lb2); // oyutanii ovog JLabel lbl3 = new JLabel("Овог:"); lbl3.setLocation(30, 110); lbl3.setSize(200, 30); con.add(lbl3); JTextField txt2 = new JTextField(); txt2.setLocation(200, 110); txt2.setSize(200, 30); con.add(txt2); JLabel lb3 = new JLabel("18 тэмдэгт"); lb3.setLocation(450, 110); lb3.setSize(200, 30); con.add(lb3); // oyutanii ner JLabel lbl4 = new JLabel("Нэр:"); lbl4.setLocation(30, 150); lbl4.setSize(200, 30); con.add(lbl4); JTextField txt3 = new JTextField(); txt3.setLocation(200, 150); txt3.setSize(200, 30); con.add(txt3); JLabel lb4 = new JLabel("18 тэмдэгт"); lb4.setLocation(450, 150); lb4.setSize(200, 30); con.add(lb4); // nuuts ug JLabel lbl5 = new JLabel("Нууц үг:"); lbl5.setLocation(30, 190); lbl5.setSize(200, 30); con.add(lbl5); JPasswordField pass1 = new JPasswordField(); pass1.setLocation(200, 190); pass1.setSize(200, 30); con.add(pass1); JLabel lb5 = new JLabel("Ихдээ 10 тэмдэгт"); lb5.setLocation(450, 190); lb5.setSize(200, 30); con.add(lb5); // nuuts ug davtalt JLabel lbl6 = new JLabel("Нууц үг давталт:"); lbl6.setLocation(30, 230); lbl6.setSize(200, 30); con.add(lbl6); JPasswordField pass2 = new JPasswordField(); pass2.setLocation(200, 230); pass2.setSize(200, 30); con.add(pass2); // huis JLabel lbl7 = new JLabel("Хүйс:"); lbl7.setLocation(30, 270); lbl7.setSize(200, 30); con.add(lbl7); JRadioButton rd1 = new JRadioButton("Эр"); rd1.setLocation(200, 270); rd1.setSize(50, 30); con.add(rd1); JRadioButton rd2 = new JRadioButton("Эм"); rd2.setLocation(260, 270); rd2.setSize(50, 30); con.add(rd2); ButtonGroup huisGroup = new ButtonGroup(); huisGroup.add(rd1); huisGroup.add(rd2); JLabel lb7 = new JLabel("Сонгодог байх"); lb7.setLocation(450, 270); lb7.setSize(200, 30); con.add(lb7); // elssen on JLabel lbl8 = new JLabel("Элссэн он:"); lbl8.setLocation(30, 310); lbl8.setSize(200, 30); con.add(lbl8); JTextField txt5 = new JTextField(); txt5.setLocation(200, 310); txt5.setSize(200, 30); con.add(txt5); JLabel lb8 = new JLabel("Жишээ:2011"); lb8.setLocation(450, 310); lb8.setSize(200, 30); con.add(lb8); // tsagiin/undsen JLabel lbl9 = new JLabel("Цагийн/Үндсэн:"); lbl9.setLocation(30, 350); lbl9.setSize(200, 30); con.add(lbl9); JCheckBox ch1 = new JCheckBox("Цаг"); ch1.setLocation(200, 340); ch1.setSize(50, 50); con.add(ch1); JCheckBox ch2 = new JCheckBox("Үндсэн"); ch2.setLocation(250, 340); ch2.setSize(80, 50); con.add(ch2); ButtonGroup checkgroup = new ButtonGroup(); checkgroup.add(ch1); checkgroup.add(ch2); JLabel lb9 = new JLabel("Олныг сонгож болох"); lb9.setLocation(450, 350); lb9.setSize(200, 30); con.add(lb9); // zereg JLabel lbl10 = new JLabel("Зэрэг:"); lbl10.setLocation(30, 390); lbl10.setSize(200, 30); con.add(lbl10); JComboBox combo2 = new JComboBox(); try { String s = "SELECT * FROM zereg"; ResultSet rs = DatabaseTools.runQuery(s); while (rs.next()) { combo2.addItem(rs.getString(2)); } } catch (Exception e) { } combo2.setLocation(200, 390); combo2.setSize(200, 30); con.add(combo2); // torol JLabel lbl11 = new JLabel("Төрөл:"); lbl11.setLocation(30, 430); lbl11.setSize(200, 30); con.add(lbl11); String str3[] = { "Захирал", "Бакалавр1", "Бакалавр2", "Бакалавр3", "Бакалавр4", }; JComboBox combo3 = new JComboBox(str3); combo3.setLocation(200, 430); combo3.setSize(200, 30); con.add(combo3); // geriin utas JLabel lbl12 = new JLabel("Гэрийн утас:"); lbl12.setLocation(30, 470); lbl12.setSize(200, 30); con.add(lbl12); JTextField txt6 = new JTextField(); txt6.setLocation(200, 470); txt6.setSize(200, 30); con.add(txt6); JLabel lb12 = new JLabel("Ихдээ 20 тэмдэгт"); lb12.setLocation(450, 470); lb12.setSize(200, 30); con.add(lb12); // gar utas JLabel lbl13 = new JLabel("Гар утас:"); lbl13.setLocation(30, 510); lbl13.setSize(200, 30); con.add(lbl13); JTextField txt7 = new JTextField(); txt7.setLocation(200, 510); txt7.setSize(200, 30); con.add(txt7); JLabel lb13 = new JLabel("Ихдээ 20 тэмдэгт"); lb13.setLocation(450, 510); lb13.setSize(200, 30); con.add(lb13); // geriin hayag JLabel lbl14 = new JLabel("Гэрийн хаяг:"); lbl14.setLocation(30, 550); lbl14.setSize(200, 30); con.add(lbl14); JTextArea ta1 = new JTextArea(); ta1.setLocation(200, 550); ta1.setSize(250, 90); con.add(ta1); JLabel lb14 = new JLabel("Ихдээ 200 тэмдэгт"); lb14.setLocation(500, 550); lb14.setSize(200, 30); con.add(lb14); // mail hayag JLabel lbl15 = new JLabel("Майл хаяг:"); lbl15.setLocation(30, 650); lbl15.setSize(200, 30); con.add(lbl15); JTextField txt8 = new JTextField(); txt8.setLocation(200, 650); txt8.setSize(200, 30); con.add(txt8); JLabel lb15 = new JLabel("Ихдээ 100 тэмдэгт"); lb15.setLocation(450, 650); lb15.setSize(200, 30); con.add(lb15); // torson odor JLabel lbl16 = new JLabel("Төрсөн өдөр:"); lbl16.setLocation(30, 690); lbl16.setSize(200, 30); con.add(lbl16); String year1[] = new String[116]; for (int on = 0; on < 116; on++) { year1[on] = Integer.toString(1900 + on); } JComboBox year = new JComboBox(year1); year.setMaximumRowCount(8); year.setLocation(200, 690); year.setSize(60, 30); con.add(year); JLabel lbl161 = new JLabel("Он"); lbl161.setLocation(265, 690); lbl161.setSize(30, 30); con.add(lbl161); String month1[] = new String[12]; for (int sar = 0; sar < 12; sar++) { month1[sar] = Integer.toString(1 + sar); } JComboBox month = new JComboBox(month1); month.setMaximumRowCount(8); month.setLocation(290, 690); month.setSize(60, 30); con.add(month); JLabel lbl162 = new JLabel("Сар"); lbl162.setLocation(355, 690); lbl162.setSize(30, 30); con.add(lbl162); String day1[] = new String[31]; for (int odor = 0; odor < 31; odor++) { day1[odor] = Integer.toString(1 + odor); } JComboBox day = new JComboBox(day1); day.setLocation(385, 690); day.setSize(60, 30); con.add(day); JLabel lbl163 = new JLabel("Өдөр"); lbl163.setLocation(450, 690); lbl163.setSize(50, 30); con.add(lbl163); JLabel lb16 = new JLabel("3-н combobox байх"); lb16.setForeground(Color.red); lb16.setLocation(550, 690); lb16.setSize(200, 30); con.add(lb16); // nemeh JButton bt1 = new JButton("Нэмэх"); bt1.setForeground(Color.blue); bt1.setLocation(600, 30); bt1.setSize(100, 40); bt1.addActionListener( ae -> { String stuLastName = txt2.getText(); String stuFirstName = txt3.getText(); String huis; if (rd1.isSelected()) huis = "эр"; else huis = "эм"; String elssenOn = txt5.getText(); String address = ta1.getText(); String phone = txt7.getText(); String mail = txt8.getText(); String code = txt1.getText(); String query1 = "insert into student(stu_lastname, stu_firstname,stu_sex,stu_elssenOn,stu_address,stu_phone,stu_mail,stu_code)" + "values('" + stuLastName + "','" + stuFirstName + "','" + huis + "','" + elssenOn + "','" + address + "','" + phone + "','" + mail + "','" + code + "')"; DatabaseTools.runQuery(query1); JOptionPane.showMessageDialog(null, "Амжилттай нэмэгдлээ."); this.dispose(); }); con.add(bt1); // tseverleh JButton bt4 = new JButton("Цэвэрлэх"); bt4.setForeground(Color.blue); bt4.setLocation(600, 180); bt4.setSize(100, 40); con.add(bt4); setLocation(800, 350); setSize(750, 800); setVisible(true); setResizable(false); }
private void initComponents() { setLayout(null); JPanel controlPanel = new JPanel(); controlPanel.setLayout(null); controlPanel.setBorder( BorderFactory.createCompoundBorder( new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5, 5, 5, 5))); controlPanel.setBounds(5, 5, 190, 385); JLabel nameLabel = new JLabel("Shape Name:"); nameLabel.setBounds(10, 5, 170, 25); controlPanel.add(nameLabel); nameField = new TextFieldWithPlaceHolder("Please enter a shape name", StringType.PLACEHOLDER); nameField.setBounds(10, 30, 170, 25); controlPanel.add(nameField); JLabel resolutionLabel = new JLabel("Grid resolution:"); resolutionLabel.setBounds(10, 55, 170, 25); controlPanel.add(resolutionLabel); resolution = new JComboBox<Vec2>(this.getComboModel()); resolution.setMaximumRowCount(30); currentResolutionSelection = resolution.getSelectedIndex(); resolution.setBounds(10, 80, 170, 25); resolution.setRenderer( new ListCellRenderer<Vec2>() { JLabel resoLabel = null; @Override public Component getListCellRendererComponent( JList<? extends Vec2> list, Vec2 value, int index, boolean isSelected, boolean cellHasFocus) { if (resoLabel == null) { resoLabel = new JLabel(); resoLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 1, 0)); } resoLabel.setText((int) value.x + "x" + (int) value.y); if (isSelected) { resoLabel.setBackground(list.getSelectionBackground()); resoLabel.setForeground(list.getSelectionForeground()); } else { resoLabel.setBackground(list.getBackground()); resoLabel.setForeground(list.getForeground()); } return resoLabel; } }); controlPanel.add(resolution); JLabel colorLabel = new JLabel("Choose color:"); colorLabel.setBounds(10, 115, 145, 25); controlPanel.add(colorLabel); colorButton = new JButton(); colorButton.setBackground(Color.green); buildPanel.setPaintColor(colorButton.getBackground()); colorButton.setBounds(155, 115, 25, 25); controlPanel.add(colorButton); saveButton = new JButton("Save"); // TODO add(controlPanel); }
public void executa() { setSize(650, 450); setLocation(200, 200); setTitle(":::Atento:::::::"); JDialog.setDefaultLookAndFeelDecorated(true); // imgIcon = new ImageIcon("usb.jpg"); assim o codigo nao funciona ImageIcon imgIcon = new ImageIcon(getClass().getResource("font.png")); ImageIcon imgAbaScript = new ImageIcon(getClass().getResource("script.png")); ImageIcon imgAbaTabulacao = new ImageIcon(getClass().getResource("page_copy.png")); ImageIcon imgAbaLembrete = new ImageIcon(getClass().getResource("report_edit.png")); ImageIcon imgBotaoIr = new ImageIcon(getClass().getResource("tick.png")); ImageIcon imgBotaoAbrir = new ImageIcon(getClass().getResource("folder_go.png")); ImageIcon imgBotaoSalvar = new ImageIcon(getClass().getResource("disk.png")); ImageIcon imgBotaoLimpar = new ImageIcon(getClass().getResource("brush.png")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setIconImage(imgIcon.getImage()); setResizable(false); pnlBotoesScript = new JPanel(); pnlBotoesScript.add(btnCriticidadeAlta = new JButton("Prioridade Alta")); btnCriticidadeAlta.setToolTipText("Para chamados de alta criticidade"); btnCriticidadeAlta.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String texto = "Inicio:\nImpacto:\nPas logadas:\nPas afetadas:\nContato:"; Acao chamadoAlto = new Acao(); chamadoAlto.copiaInformacao(texto); } }); pnlBotoesScript.add(btnLoginNT = new JButton("LoginNT")); btnLoginNT.setToolTipText("Para chamados de Reset LoginNT"); btnLoginNT.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String textoResetNt = "O Reset de para loginNT foi realizado com sucesso, a nova senha é " + "atento@2011, que deve ser alterada no primeiro logon. " + "A senha deve ter no mínimo 8 caracteres, dentre os caracteres " + "é obrigatório ter letras, números e caracteres especiais como por Ex: @ ! ?. " + "OBS: A senha não pode ser a mesma nos últimos 12 meses."; Acao resetDeSenha = new Acao(); resetDeSenha.copiaInformacao(textoResetNt); } }); pnlBotoesScript.add(btnLoginCMS = new JButton("LoginCMS")); btnLoginCMS.setToolTipText("Para chamados de Reset LoginCMS"); btnLoginCMS.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String textoResetCMS = "O reset de login CMS foi realizado com sucesso.\nOBS: Não há senha,\nO sistema solicitara ao usuario cadastrar uma nova senha no primeiro acesso."; Acao loginCMS = new Acao(); loginCMS.copiaInformacao(textoResetCMS); } }); pnlLembrete = new JPanel(new BorderLayout()); pnlLembrete.add( barraDeRolagem = new JScrollPane( text = new JTextArea(), JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.CENTER); text.setEditable(true); text.setBackground(Color.white); pnlBotoesLembrete = new JPanel(new FlowLayout()); pnlBotoesLembrete.add(btnAbrir = new JButton(imgBotaoAbrir)); btnAbrir.setToolTipText("Abrir Alt+A"); btnAbrir.setMnemonic('a'); btnAbrir.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { ManipulaArquivo manipulaArquivoAbrir = new ManipulaArquivo(); try { manipulaArquivoAbrir.abriArquivo(text); } catch (IOException e) { JOptionPane.showConfirmDialog(null, "Não é possivel abrir o arquivo"); e.printStackTrace(); } } }); pnlBotoesLembrete.add(btnSalvar = new JButton(imgBotaoSalvar)); btnSalvar.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { ManipulaArquivo manipulaArquivoSalva = new ManipulaArquivo(); String conteudoDoTextArea = text.getText(); try { manipulaArquivoSalva.salvaArquivo(conteudoDoTextArea); } catch (IOException e) { JOptionPane.showConfirmDialog( null, "Não é possivel salvar o arquivo, tente novamente"); e.printStackTrace(); } } }); btnSalvar.setToolTipText("Salvar Alt+S"); btnSalvar.setMnemonic('s'); pnlLembrete.add(pnlBotoesLembrete, BorderLayout.SOUTH); pnlBotoesLembrete.add(btnLimpar = new JButton(imgBotaoLimpar)); btnLimpar.setToolTipText("Limpa tela Alt+L"); btnLimpar.setMnemonic('l'); btnLimpar.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { text.setText(""); } }); pnlTabulacao = new JPanel(new BorderLayout()); pnlTabulacao.setBackground(getBackground()); pnlBotaoTabulacaoLista = new JPanel(new FlowLayout(FlowLayout.LEFT)); pnlBotaoTabulacaoLista.add(listaDeTabulacao = new JComboBox(tabulacoes)); listaDeTabulacao.setMaximumRowCount(15); pnlBotaoTabulacaoLista.add(btnIr = new JButton(imgBotaoIr)); btnIr.setToolTipText("Pressione para que as informações sejam copiadas"); pnlTabulacao.add(pnlBotaoTabulacaoLista, BorderLayout.NORTH); pnlBotaoTabulacao = new JPanel(new FlowLayout()); pnlBotaoTabulacao.add(btnAbertura = new JButton("Descrição do chamado")); pnlBotaoTabulacao.add(btnFechamento = new JButton("Fechamento de chamado")); pnlTabulacao.add(pnlBotaoTabulacao, BorderLayout.SOUTH); String chamadoIntranetAbertura = "Usuario solicitou a abertura de chamado para (Descreva o chamado)"; String chamadoIntranetFechamento = "Orientado o usuario para abrir o chamado pela intranet atraves do filtro (Descreva os filtros)."; String cobrancaAbertura = "Usuario entrou em contato para a cobrança do chamado(Numero do chamado)."; String cobrancaChamadosFechamento = "Usuario orientado a efetuar a cobrança do chamado pelo Service Desk ."; String consultaChamadosAbertura = "Usuario entrou em contato para a consulta do chamado(Numero do chamado)."; String consultaChamadosFechamento = "Usuario orientado a efetuar a consulta do chamado pelo Service Desk ."; String correcaoChamadoAbertura = "Usuario entrou em contato para corrigir a descrição do chamado(Numero do chamado) ."; String correcaoChamadoFechamento = "Efetuado a correção do chamado pelo Service Desk"; String duvidasCodeAbertura = "Usuario entrou em contato devido a(Duvida que o mesmo tem sobre o Authorization Code)."; String duvidasCodeFechamento = "Orientado o usuario para (Orientação sobre a duvida no Authorrization Code)."; String duvidasTimeSheetAbertura = "Usuario entrou em contato devido a(Duvida que o mesmo tem sobre o TimeSheet) ."; String duvidasTimeSheetFechamento = "Orientado o usuario para (Orientação sobre a duvida no TimeSheet)."; String erroDeskAbertura = "Ligação indevida para a opção (número da Opção ) do Menu."; String erroDeskFechamento = "Transferido usuario para o Menu do Service Desk"; String informacaoDiversaAbertura = "Usuario solicitou informações sobre(Descrever o tipo de informação) ."; String informacaoDiversaFechamento = "Usuario foi orientado para (Descrever a informação passada)."; String ligacaoAbertura = "O cliente (Nome da empresa) entrou em contato querendo informações sobre o status da indisponibilidade do aplicativo (Nome do aplicativo)."; String ligacaoFechamento = "Passada a ligação para o Back Office HD1 para verifificação \nVerificação feita junto a operação."; String ligacaoTecnicaAbertura = "O analista (Nome do analista) entrou em contato para [( voltar o chamado (numero do chamado) para o cliente) ou ((para falar com o Back office) "; String ligacaoTecncaFechamento = "Informado o analista que o chamado será aberto no cliente \nPassado o chamado/ligação para o back office."; String ligacaoMudaAbertura = "A ligação estava muda. "; String ligacaoMudaFechamento = "Devido ao problema a ligação foi encerrada"; String normalizadoLigacaoAbertura = "Usuario entrou em contato devido(Descreva o problema)."; String normalizadoLigacaoFechamento = "Conforme informado pelo usuario, o problema normalizou durante o atendimento."; String problemaDeskAbertura = "Usuario informa que não consegue acessar o Service Desk devido(Descreva o problema)."; String problemaDeskFechamento = "(Descrever a ação tomada para resolver o problema) e o usuario já consegue acessar o Service Desk."; String quedaLigacaoAbertura = "Houve queda de ligação durante o atendimento."; String quedaLigacaoFechamento = "Queda de ligações"; String reaberturaChamadoAbertura = "Usuario entrou em contato para reabrir o chamado (Numero do chamado). devido a (Motivo da Reabertura)."; String reaberturaChamadoFechamento = "Reaberto o chamado conforme solicitado pelo usuario."; String cancelamentoChamadoAbertura = "Usuario solicita o cancelamento do chamado (Numero do chamado) devido a (Motivo do cancelamento)."; String cancelametoChamadoFechamento = "Cancelado o chamado conforme solicitado pelo usuario ."; Acao referenciaAcao = new Acao(); referenciaAcao.executaAcaoArray0( btnIr, listaDeTabulacao, tabulacoes, null, null, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray1( btnIr, listaDeTabulacao, tabulacoes, chamadoIntranetAbertura, chamadoIntranetFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray2( btnIr, listaDeTabulacao, tabulacoes, cobrancaAbertura, cobrancaChamadosFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray3( btnIr, listaDeTabulacao, tabulacoes, consultaChamadosAbertura, consultaChamadosFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray4( btnIr, listaDeTabulacao, tabulacoes, correcaoChamadoAbertura, correcaoChamadoFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray5( btnIr, listaDeTabulacao, tabulacoes, duvidasCodeAbertura, duvidasCodeFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray6( btnIr, listaDeTabulacao, tabulacoes, duvidasTimeSheetAbertura, duvidasTimeSheetFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray7( btnIr, listaDeTabulacao, tabulacoes, erroDeskAbertura, erroDeskFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray8( btnIr, listaDeTabulacao, tabulacoes, informacaoDiversaAbertura, informacaoDiversaFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray9( btnIr, listaDeTabulacao, tabulacoes, ligacaoAbertura, ligacaoFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray10( btnIr, listaDeTabulacao, tabulacoes, ligacaoTecnicaAbertura, ligacaoTecncaFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray11( btnIr, listaDeTabulacao, tabulacoes, ligacaoMudaAbertura, ligacaoMudaFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray12( btnIr, listaDeTabulacao, tabulacoes, normalizadoLigacaoAbertura, normalizadoLigacaoFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray13( btnIr, listaDeTabulacao, tabulacoes, problemaDeskAbertura, problemaDeskFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray14( btnIr, listaDeTabulacao, tabulacoes, quedaLigacaoAbertura, quedaLigacaoFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray15( btnIr, listaDeTabulacao, tabulacoes, reaberturaChamadoAbertura, reaberturaChamadoFechamento, btnAbertura, btnFechamento); referenciaAcao.executaAcaoArray16( btnIr, listaDeTabulacao, tabulacoes, cancelamentoChamadoAbertura, cancelametoChamadoFechamento, btnAbertura, btnFechamento); tabs = new JTabbedPane(JTabbedPane.TOP); tabs.addTab("Script", imgAbaScript, pnlBotoesScript); tabs.addTab("Lembrete", imgAbaLembrete, pnlLembrete); tabs.addTab("Tabulação", imgAbaTabulacao, pnlTabulacao); getContentPane().add(tabs); setVisible(true); }
public void createDataEditPanelCourse(String CourseNo, String CourseName, String CourseCredit) { this.CourseNo = CourseNo; this.CourseName = CourseName; this.CourseCredit = CourseCredit; Credit = Float.parseFloat(CourseCredit); if (Credit == 0.75) CreditIndex = 0; else if (Credit == 1.50) CreditIndex = 1; else if (Credit == 3.00) CreditIndex = 2; else CreditIndex = 3; DEPC = new JDialog(); DEPC.setTitle("Course Edit Dialog"); Panel = new JPanel() { protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage( new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(), 0, 0, 600, 230, null); ButtonBorder.paintBorder(this, g, 172, 136, 130, 25); } }; Panel.setForeground(Color.WHITE); Panel.setLayout(null); CourseNoLabel1 = new JLabel("Course No. : "); CourseNoLabel1.setForeground(Color.WHITE); CourseNoLabel1.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12)); CourseNoLabel1.setBounds(77, 29, 139, 27); Panel.add(CourseNoLabel1); CourseNoLabel2 = new JLabel(this.CourseNo); CourseNoLabel2.setForeground(Color.WHITE); CourseNoLabel2.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 12)); CourseNoLabel2.setBounds(213, 29, 200, 27); Panel.add(CourseNoLabel2); CourseNameLabel = new JLabel("Course Title :"); CourseNameLabel.setForeground(Color.WHITE); CourseNameLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12)); CourseNameLabel.setBounds(77, 56, 139, 26); Panel.add(CourseNameLabel); CourseNameField = new JTextField(this.CourseName); CourseNameField.setForeground(Color.WHITE); CourseNameField.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 10)); CourseNameField.setBounds(213, 60, 200, 20); CourseNameField.setOpaque(false); CourseNameField.setHorizontalAlignment(SwingConstants.CENTER); Panel.add(CourseNameField); CourseCreditLabel = new JLabel("Course Credit :"); CourseCreditLabel.setForeground(Color.WHITE); CourseCreditLabel.setBounds(77, 87, 139, 26); CourseCreditLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12)); Panel.add(CourseCreditLabel); CourseCreditBox = new JComboBox<String>(); CourseCreditBox.setBackground(Color.GRAY); CourseCreditBox.setForeground(new Color(28, 0, 0)); CourseCreditBox.setBounds(213, 91, 103, 20); CourseCreditBox.setBorder(ButtonBorder); CourseCreditBox.addItem("0.75"); CourseCreditBox.addItem("1.50"); CourseCreditBox.addItem("3.00"); CourseCreditBox.addItem("4.00"); CourseCreditBox.setMaximumRowCount(3); CourseCreditBox.setSelectedIndex(CreditIndex); Panel.add(CourseCreditBox); UpdateButton = new JButton("Update"); UpdateButton.setForeground(Color.WHITE); UpdateButton.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 10)); UpdateButton.setBounds(173, 137, 128, 23); UpdateButton.setContentAreaFilled(false); UpdateButton.addActionListener(this); Panel.add(UpdateButton); DEPC.getContentPane().add(Panel); DEPC.setSize(500, 230); DEPC.setLocation(500, 200); DEPC.setResizable(false); DEPC.setVisible(true); DEPC.setModal(true); }
public ResourcePanel(AndroidFacet facet, ResourceType[] types, boolean system) { myTree = new Tree(); myTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode())); myTree.setScrollsOnExpand(true); myTree.setRootVisible(false); myTree.setShowsRootHandles(true); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { if (!myTreeBuilder.getSelectedElements(ResourceItem.class).isEmpty()) { close(OK_EXIT_CODE); return true; } return false; } }.installOn(myTree); ToolTipManager.sharedInstance().registerComponent(myTree); TreeUtil.installActions(myTree); myManager = facet.getResourceManager(system ? AndroidUtils.SYSTEM_RESOURCE_PACKAGE : null); myGroups = new ResourceGroup[types.length]; for (int i = 0; i < types.length; i++) { myGroups[i] = new ResourceGroup(types[i], myManager); } myTreeBuilder = new AbstractTreeBuilder( myTree, (DefaultTreeModel) myTree.getModel(), new TreeContentProvider(myGroups), null); myTreeBuilder.initRootNode(); TreeSelectionModel selectionModel = myTree.getSelectionModel(); selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); selectionModel.addTreeSelectionListener(ChooseResourceDialog.this); myTree.setCellRenderer(new NodeRenderer()); new TreeSpeedSearch(myTree, TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING, true); myComponent = new JBSplitter(true, 0.8f); myComponent.setSplitterProportionKey("android.resource_dialog_splitter"); myComponent.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree)); myPreviewPanel = new JPanel(new CardLayout()); myComponent.setSecondComponent(myPreviewPanel); myTextArea = new JTextArea(5, 20); myTextArea.setEditable(false); myPreviewPanel.add(ScrollPaneFactory.createScrollPane(myTextArea), TEXT); myComboTextArea = new JTextArea(5, 20); myComboTextArea.setEditable(false); myComboBox = new JComboBox(); myComboBox.setMaximumRowCount(15); myComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { java.util.List<ResourceElement> resources = (java.util.List<ResourceElement>) myComboBox.getClientProperty(COMBO); myComboTextArea.setText( getResourceElementValue(resources.get(myComboBox.getSelectedIndex()))); } }); JPanel comboPanel = new JPanel( new BorderLayout(0, 1) { @Override public void layoutContainer(Container target) { super.layoutContainer(target); Rectangle bounds = myComboBox.getBounds(); Dimension size = myComboBox.getPreferredSize(); size.width += 20; myComboBox.setBounds( (int) bounds.getMaxX() - size.width, bounds.y, size.width, size.height); } }); comboPanel.add(ScrollPaneFactory.createScrollPane(myComboTextArea), BorderLayout.CENTER); comboPanel.add(myComboBox, BorderLayout.SOUTH); myPreviewPanel.add(comboPanel, COMBO); myImageComponent = new JLabel(); myImageComponent.setHorizontalAlignment(SwingConstants.CENTER); myImageComponent.setVerticalAlignment(SwingConstants.CENTER); myPreviewPanel.add(myImageComponent, IMAGE); myNoPreviewComponent = new JLabel("No Preview"); myNoPreviewComponent.setHorizontalAlignment(SwingConstants.CENTER); myNoPreviewComponent.setVerticalAlignment(SwingConstants.CENTER); myPreviewPanel.add(myNoPreviewComponent, NONE); }
/** Creates a new WelcomeFrame and makes it visible. */ public WelcomeFrame() { setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { public void windowClosing(final WindowEvent event) { cancel(); }; }); setIconImage(Icons.SC2GEARS.getImage()); final Box box = Box.createVerticalBox(); box.add(Box.createVerticalStrut(5)); box.add(GuiUtils.wrapInPanel(SharedUtils.createAnimatedLogoLabel())); box.add(Box.createVerticalStrut(10)); GuiUtils.changeFontToBold(welcomeLabel); box.add(Box.createVerticalStrut(15)); box.add(GuiUtils.wrapInPanel(welcomeLabel)); box.add(Box.createVerticalStrut(15)); box.add(GuiUtils.wrapInPanel(firstRunLabel)); box.add(GuiUtils.wrapInPanel(chooseLabel)); box.add(Box.createVerticalStrut(15)); box.add(GuiUtils.wrapInPanel(thankYouLabel)); box.add(Box.createVerticalStrut(15)); final JPanel languagePanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 1)); languagePanel.add(languageLabel); final JComboBox<String> languagesComboBox = new JComboBox<>(Language.getAvailableLanguages()); languagesComboBox.setMaximumRowCount( languagesComboBox.getModel().getSize()); // Display all languages languagesComboBox.setRenderer( new BaseLabelListCellRenderer<String>() { @Override public Icon getIcon(final String value) { return Icons.getLanguageIcon(value); } }); languagesComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { final String language = (String) languagesComboBox.getSelectedItem(); Language.loadAndActivateLanguage(language); reassignTexts(); } }); languagePanel.add(languagesComboBox); box.add(languagePanel); final JPanel voicePanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 1)); voicePanel.add(voiceLabel); final JComboBox<VoiceDescription> voiceComboBox = new JComboBox<>(Sounds.VOICE_DESCRIPTIONS); voiceComboBox.setMaximumRowCount(15); // Not too many languages, display them all voiceComboBox.setRenderer( new BaseLabelListCellRenderer<VoiceDescription>() { @Override public Icon getIcon(final VoiceDescription value) { return Icons.getLanguageIcon(value.language); } }); voiceComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { final VoiceDescription voiceDescription = (VoiceDescription) voiceComboBox.getSelectedItem(); Settings.set(Settings.KEY_SETTINGS_VOICE, voiceDescription.name); Sounds.playSoundSample(Sounds.SAMPLE_WELCOME, false); } }); voicePanel.add(voiceComboBox); box.add(voicePanel); int maxWidth = Math.max( languagesComboBox.getPreferredSize().width, voiceComboBox.getPreferredSize().width); maxWidth += 5; languagesComboBox.setPreferredSize( new Dimension(maxWidth, languagesComboBox.getPreferredSize().height)); voiceComboBox.setPreferredSize( new Dimension(maxWidth, voiceComboBox.getPreferredSize().height)); box.add(Box.createVerticalStrut(15)); final JPanel buttonsPanel = new JPanel(); okButton.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { dispose(); Settings.set( Settings.KEY_SETTINGS_LANGUAGE, (String) languagesComboBox.getSelectedItem()); Settings.saveProperties(); synchronized (WelcomeFrame.this) { Sounds.playSoundSample(Sounds.SAMPLE_THANK_YOU, false); WelcomeFrame.this .notify(); // Notify the main thread to continue starting the application } } }); buttonsPanel.add(okButton); cancelButton.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { cancel(); } }); buttonsPanel.add(cancelButton); box.add(buttonsPanel); box.add(Box.createVerticalStrut(15)); final JPanel panel = new JPanel(); panel.add(Box.createHorizontalStrut(15)); panel.add(box); panel.add(Box.createHorizontalStrut(15)); getContentPane().add(panel); setResizable(false); reassignTexts(); setVisible(true); okButton.requestFocusInWindow(); Sounds.playSoundSample(Sounds.SAMPLE_WELCOME, false); }
private void initializeContent(Locale[] locales) { FormLayout layout = new FormLayout("pref:grow"); DefaultFormBuilder builder = new DefaultFormBuilder(layout); // add locales to model and select the best match DefaultComboBoxModel localeModel = new DefaultComboBoxModel(); int selectedScore = -1; int selectedIndex = -1; Locale systemLocale = Locale.getDefault(); for (int i = 0; i < locales.length; i++) { localeModel.addElement(locales[i]); int score = LanguageUtils.getMatchScore(currentLocale, locales[i]); if (score > selectedScore) { selectedScore = score; selectedIndex = i; } if (locales[i].equals(systemLocale)) { defaultLocaleSelectable = true; } } localeComboBox = new JComboBox(localeModel); localeComboBox.setRenderer(LanguageFlagFactory.getListRenderer()); localeComboBox.setMaximumRowCount(15); if (selectedIndex != -1) { localeComboBox.setSelectedIndex(selectedIndex); } builder.append(localeComboBox); builder.nextLine(); // reflect the changed language right away so someone who doesn't speak // English or whatever language it the default can understand what the // buttons say localeComboBox.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Locale selected = (Locale) e.getItem(); if (selected != null && !currentLocale.equals(selected)) { updateLabels(selected); // hide the flag by default for english locales to save // space in the status bar showLanguageCheckbox.setSelected(!LanguageUtils.isEnglishLocale(selected)); currentLocale = selected; } } } }); helpTranslateLabel = new URLLabel(TRANSLATE_URL, ""); builder.append(helpTranslateLabel); builder.nextLine(); builder.append(Box.createVerticalStrut(15)); builder.nextLine(); showLanguageCheckbox = new JCheckBox(); showLanguageCheckbox.setSelected(StatusBarSettings.LANGUAGE_DISPLAY_ENABLED.getValue()); builder.append(showLanguageCheckbox); builder.nextLine(); builder.append(Box.createVerticalStrut(5)); builder.nextLine(); mainPanel.add(builder.getPanel(), BorderLayout.CENTER); }
public SchemaEditorToolBar(final BasicGraphEditor editor, int orientation) { super(orientation); setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(3, 3, 3, 3), getBorder())); setFloatable(false); add( editor.bind( "New", new EditorActions.NewAction(), "/com/gkd/jgraphx_example/images/new.gif")); add( editor.bind( "Open", new EditorActions.OpenAction(), "/com/gkd/jgraphx_example/images/open.gif")); add( editor.bind( "Save", new EditorActions.SaveAction(false), "/com/gkd/jgraphx_example/images/save.gif")); addSeparator(); add( editor.bind( "Print", new EditorActions.PrintAction(), "/com/gkd/jgraphx_example/images/print.gif")); addSeparator(); add( editor.bind( "Cut", TransferHandler.getCutAction(), "/com/gkd/jgraphx_example/images/cut.gif")); add( editor.bind( "Copy", TransferHandler.getCopyAction(), "/com/gkd/jgraphx_example/images/copy.gif")); add( editor.bind( "Paste", TransferHandler.getPasteAction(), "/com/gkd/jgraphx_example/images/paste.gif")); addSeparator(); add( editor.bind( "Delete", mxGraphActions.getDeleteAction(), "/com/gkd/jgraphx_example/images/delete.gif")); addSeparator(); add( editor.bind( "Undo", new EditorActions.HistoryAction(true), "/com/gkd/jgraphx_example/images/undo.gif")); add( editor.bind( "Redo", new EditorActions.HistoryAction(false), "/com/gkd/jgraphx_example/images/redo.gif")); addSeparator(); final mxGraphView view = editor.getGraphComponent().getGraph().getView(); final JComboBox zoomCombo = new JComboBox( new Object[] { "400%", "200%", "150%", "100%", "75%", "50%", mxResources.get("page"), mxResources.get("width"), mxResources.get("actualSize") }); zoomCombo.setEditable(true); zoomCombo.setMinimumSize(new Dimension(75, 0)); zoomCombo.setPreferredSize(new Dimension(75, 0)); zoomCombo.setMaximumSize(new Dimension(75, 100)); zoomCombo.setMaximumRowCount(9); add(zoomCombo); // Sets the zoom in the zoom combo the current value mxIEventListener scaleTracker = new mxIEventListener() { /** */ public void invoke(Object sender, mxEventObject evt) { ignoreZoomChange = true; try { zoomCombo.setSelectedItem((int) Math.round(100 * view.getScale()) + "%"); } finally { ignoreZoomChange = false; } } }; // Installs the scale tracker to update the value in the combo box // if the zoom is changed from outside the combo box view.getGraph().getView().addListener(mxEvent.SCALE, scaleTracker); view.getGraph().getView().addListener(mxEvent.SCALE_AND_TRANSLATE, scaleTracker); // Invokes once to sync with the actual zoom value scaleTracker.invoke(null, null); zoomCombo.addActionListener( new ActionListener() { /** */ public void actionPerformed(ActionEvent e) { mxGraphComponent graphComponent = editor.getGraphComponent(); // Zoomcombo is changed when the scale is changed in the diagram // but the change is ignored here if (!ignoreZoomChange) { String zoom = zoomCombo.getSelectedItem().toString(); if (zoom.equals(mxResources.get("page"))) { graphComponent.setPageVisible(true); graphComponent.setZoomPolicy(mxGraphComponent.ZOOM_POLICY_PAGE); } else if (zoom.equals(mxResources.get("width"))) { graphComponent.setPageVisible(true); graphComponent.setZoomPolicy(mxGraphComponent.ZOOM_POLICY_WIDTH); } else if (zoom.equals(mxResources.get("actualSize"))) { graphComponent.zoomActual(); } else { try { zoom = zoom.replace("%", ""); double scale = Math.min(16, Math.max(0.01, Double.parseDouble(zoom) / 100)); graphComponent.zoomTo(scale, graphComponent.isCenterZoom()); } catch (Exception ex) { JOptionPane.showMessageDialog(editor, ex.getMessage()); } } } } }); }
/** Create the dialog */ public OptionsDlg( MMOptions opts, CMMCore core, Preferences mainPrefs, ScriptInterface parent, String cfgPath) { super(); currentCfgPath_ = cfgPath; parent_ = parent; addWindowListener( new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { savePosition(); parent_.makeActive(); } }); setResizable(false); setModal(true); opts_ = opts; core_ = core; mainPrefs_ = mainPrefs; setTitle("Micro-Manager Options"); springLayout = new SpringLayout(); getContentPane().setLayout(springLayout); setBounds(100, 100, 371, 320); guiColors_ = new GUIColors(); Dimension buttonSize = new Dimension(120, 20); if (opts_.displayBackground_.equals("Day")) { setBackground(java.awt.SystemColor.control); } else if (opts_.displayBackground_.equals("Night")) { setBackground(java.awt.Color.gray); } Preferences root = Preferences.userNodeForPackage(this.getClass()); setPrefsNode(root.node(root.absolutePath() + "/OptionsDlg")); Rectangle r = getBounds(); loadPosition(r.x, r.y); final JCheckBox debugLogEnabledCheckBox = new JCheckBox(); debugLogEnabledCheckBox.setToolTipText("Set extra verbose logging for debugging purposes"); debugLogEnabledCheckBox.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { opts_.debugLogEnabled_ = debugLogEnabledCheckBox.isSelected(); core_.enableDebugLog(opts_.debugLogEnabled_); } }); debugLogEnabledCheckBox.setText("Debug log enabled"); getContentPane().add(debugLogEnabledCheckBox); springLayout.putConstraint( SpringLayout.SOUTH, debugLogEnabledCheckBox, 30, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, debugLogEnabledCheckBox, 7, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.EAST, debugLogEnabledCheckBox, 190, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.WEST, debugLogEnabledCheckBox, 10, SpringLayout.WEST, getContentPane()); debugLogEnabledCheckBox.setSelected(opts_.debugLogEnabled_); final JCheckBox doNotAskForConfigFileCheckBox = new JCheckBox(); doNotAskForConfigFileCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { opts_.doNotAskForConfigFile_ = doNotAskForConfigFileCheckBox.isSelected(); } }); doNotAskForConfigFileCheckBox.setText("Do not ask for config file"); getContentPane().add(doNotAskForConfigFileCheckBox); springLayout.putConstraint( SpringLayout.EAST, doNotAskForConfigFileCheckBox, 220, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.WEST, doNotAskForConfigFileCheckBox, 0, SpringLayout.WEST, debugLogEnabledCheckBox); springLayout.putConstraint( SpringLayout.SOUTH, doNotAskForConfigFileCheckBox, 50, SpringLayout.NORTH, getContentPane()); doNotAskForConfigFileCheckBox.setSelected(opts_.doNotAskForConfigFile_); final JButton clearLogFileButton = new JButton(); clearLogFileButton.setMargin(new Insets(0, 0, 0, 0)); clearLogFileButton.setToolTipText("Erases all entries in the current log file (recommended)"); clearLogFileButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { core_.clearLog(); parent_.logStartupProperties(); } }); clearLogFileButton.setFont(new Font("", Font.PLAIN, 10)); clearLogFileButton.setText("Clear log file"); clearLogFileButton.setPreferredSize(buttonSize); getContentPane().add(clearLogFileButton); // springLayout.putConstraint(SpringLayout.SOUTH, clearLogFileButton, 166, SpringLayout.NORTH, // getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, clearLogFileButton, 175, SpringLayout.NORTH, getContentPane()); final JButton clearRegistryButton = new JButton(); clearRegistryButton.setToolTipText("Clears all persistent settings and returns to defaults"); clearRegistryButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { try { boolean previouslyRegistered = mainPrefs_.getBoolean(RegistrationDlg.REGISTRATION, false); mainPrefs_.clear(); Preferences acqPrefs = mainPrefs_.node( mainPrefs_.absolutePath() + "/" + AcqControlDlg.ACQ_SETTINGS_NODE); acqPrefs.clear(); // restore registration flag mainPrefs_.putBoolean(RegistrationDlg.REGISTRATION, previouslyRegistered); } catch (BackingStoreException exc) { ReportingUtils.showError(e); } } }); clearRegistryButton.setText("Clear registry"); clearRegistryButton.setFont(new Font("", Font.PLAIN, 10)); clearRegistryButton.setPreferredSize(buttonSize); getContentPane().add(clearRegistryButton); springLayout.putConstraint( SpringLayout.EAST, clearLogFileButton, 0, SpringLayout.EAST, clearRegistryButton); springLayout.putConstraint( SpringLayout.WEST, clearLogFileButton, 0, SpringLayout.WEST, clearRegistryButton); springLayout.putConstraint( SpringLayout.NORTH, clearRegistryButton, 210, SpringLayout.NORTH, getContentPane()); // springLayout.putConstraint(SpringLayout.EAST, clearRegistryButton, 80, SpringLayout.WEST, // getContentPane()); final JButton okButton = new JButton(); okButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { try { opts_.circularBufferSizeMB_ = NumberUtils.displayStringToInt(bufSizeField_.getText()); } catch (Exception e1) { ReportingUtils.showError(e1); return; } opts_.startupScript_ = startupScriptFile_.getText(); savePosition(); parent_.makeActive(); dispose(); } }); okButton.setText("Close"); okButton.setFont(new Font("", Font.PLAIN, 10)); okButton.setPreferredSize(buttonSize); getContentPane().add(okButton); springLayout.putConstraint( SpringLayout.NORTH, okButton, 12, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.SOUTH, okButton, 35, SpringLayout.NORTH, getContentPane()); final JLabel sequenceBufferSizeLabel = new JLabel(); sequenceBufferSizeLabel.setText("Sequence buffer size [MB]"); getContentPane().add(sequenceBufferSizeLabel); springLayout.putConstraint( SpringLayout.EAST, sequenceBufferSizeLabel, 180, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.WEST, sequenceBufferSizeLabel, 15, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.SOUTH, sequenceBufferSizeLabel, 84, SpringLayout.NORTH, getContentPane()); // springLayout.putConstraint(SpringLayout.NORTH, sequenceBufferSizeLabel, 95, // SpringLayout.NORTH, getContentPane()); bufSizeField_ = new JTextField(Integer.toString(opts_.circularBufferSizeMB_)); getContentPane().add(bufSizeField_); springLayout.putConstraint( SpringLayout.SOUTH, bufSizeField_, 85, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, bufSizeField_, 65, SpringLayout.NORTH, getContentPane()); final JLabel displayLabel = new JLabel(); // displayLabel.setFont(new Font("Arial", Font.PLAIN, 10)); displayLabel.setText("Display-Background"); getContentPane().add(displayLabel); springLayout.putConstraint( SpringLayout.EAST, displayLabel, 170, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.WEST, displayLabel, 15, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.SOUTH, displayLabel, 108, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, displayLabel, 92, SpringLayout.NORTH, getContentPane()); comboDisplayBackground_ = new JComboBox(guiColors_.styleOptions); comboDisplayBackground_.setFont(new Font("Arial", Font.PLAIN, 10)); comboDisplayBackground_.setMaximumRowCount(2); comboDisplayBackground_.setSelectedItem(opts_.displayBackground_); comboDisplayBackground_.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { changeBackground(); } }); getContentPane().add(comboDisplayBackground_); springLayout.putConstraint( SpringLayout.EAST, bufSizeField_, 0, SpringLayout.EAST, comboDisplayBackground_); springLayout.putConstraint( SpringLayout.WEST, bufSizeField_, 220, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.EAST, comboDisplayBackground_, 331, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.WEST, comboDisplayBackground_, 220, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.SOUTH, comboDisplayBackground_, 114, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, comboDisplayBackground_, 91, SpringLayout.NORTH, getContentPane()); final JLabel startupScriptLabel = new JLabel(); startupScriptLabel.setText("Startup script"); getContentPane().add(startupScriptLabel); springLayout.putConstraint( SpringLayout.WEST, clearRegistryButton, 5, SpringLayout.WEST, startupScriptLabel); springLayout.putConstraint( SpringLayout.EAST, startupScriptLabel, 115, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.WEST, startupScriptLabel, 0, SpringLayout.WEST, displayLabel); springLayout.putConstraint( SpringLayout.SOUTH, startupScriptLabel, 135, SpringLayout.NORTH, getContentPane()); startupScriptFile_ = new JTextField(opts_.startupScript_); getContentPane().add(startupScriptFile_); springLayout.putConstraint( SpringLayout.EAST, okButton, 0, SpringLayout.EAST, startupScriptFile_); springLayout.putConstraint( SpringLayout.WEST, okButton, 250, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.EAST, startupScriptFile_, 131, SpringLayout.WEST, comboDisplayBackground_); springLayout.putConstraint( SpringLayout.WEST, startupScriptFile_, 140, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.SOUTH, startupScriptFile_, 137, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, startupScriptFile_, 5, SpringLayout.SOUTH, comboDisplayBackground_); final JCheckBox conserveRamCheckBox = new JCheckBox(); conserveRamCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { opts_.conserveRam_ = conserveRamCheckBox.isSelected(); MMStudioMainFrame.getInstance().setExitStrategy(opts_.closeOnExit_); } }); conserveRamCheckBox.setText("Conserve RAM"); getContentPane().add(conserveRamCheckBox); springLayout.putConstraint( SpringLayout.NORTH, conserveRamCheckBox, 0, SpringLayout.NORTH, clearLogFileButton); springLayout.putConstraint( SpringLayout.WEST, conserveRamCheckBox, 5, SpringLayout.EAST, clearLogFileButton); conserveRamCheckBox.setSelected(opts_.conserveRam_); final JCheckBox autoreloadDevicesCheckBox = new JCheckBox(); autoreloadDevicesCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { opts_.autoreloadDevices_ = autoreloadDevicesCheckBox.isSelected(); } }); autoreloadDevicesCheckBox.setText("Auto-reload devices (Danger!)"); getContentPane().add(autoreloadDevicesCheckBox); springLayout.putConstraint( SpringLayout.NORTH, autoreloadDevicesCheckBox, 20, SpringLayout.NORTH, conserveRamCheckBox); springLayout.putConstraint( SpringLayout.WEST, autoreloadDevicesCheckBox, 0, SpringLayout.WEST, conserveRamCheckBox); autoreloadDevicesCheckBox.setSelected(opts_.autoreloadDevices_); final JCheckBox closeOnExitCheckBox = new JCheckBox(); closeOnExitCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { opts_.closeOnExit_ = closeOnExitCheckBox.isSelected(); MMStudioMainFrame.getInstance().setExitStrategy(opts_.closeOnExit_); } }); closeOnExitCheckBox.setText("Close app when quitting MM"); getContentPane().add(closeOnExitCheckBox); // springLayout.putConstraint(SpringLayout.EAST, closeOnExitCheckBox, 220, SpringLayout.WEST, // getContentPane()); // springLayout.putConstraint(SpringLayout.WEST, closeOnExitCheckBox, 0, SpringLayout.WEST, // debugLogEnabledCheckBox); // springLayout.putConstraint(SpringLayout.SOUTH, closeOnExitCheckBox, 60, SpringLayout.NORTH, // getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, closeOnExitCheckBox, 20, SpringLayout.NORTH, autoreloadDevicesCheckBox); springLayout.putConstraint( SpringLayout.WEST, closeOnExitCheckBox, 0, SpringLayout.WEST, autoreloadDevicesCheckBox); closeOnExitCheckBox.setSelected(opts_.closeOnExit_); final JComboBox prefZoomCombo = new JComboBox(); prefZoomCombo.setModel( new DefaultComboBoxModel( new String[] { "8%", "12%", "16%", "25%", "33%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%" })); double mag = opts_.windowMag_; int index = 0; if (mag == 0.25 / 3.0) { index = 0; } else if (mag == 0.125) { index = 1; } else if (mag == 0.16) { index = 2; } else if (mag == 0.25) { index = 3; } else if (mag == 0.33) { index = 4; } else if (mag == 0.5) { index = 5; } else if (mag == 0.75) { index = 6; } else if (mag == 1.0) { index = 7; } else if (mag == 1.5) { index = 8; } else if (mag == 2.0) { index = 9; } else if (mag == 3.0) { index = 10; } else if (mag == 4.0) { index = 11; } else if (mag == 6.0) { index = 12; } prefZoomCombo.setSelectedIndex(index); prefZoomCombo.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { switch (prefZoomCombo.getSelectedIndex()) { case (0): opts_.windowMag_ = 0.25 / 3.0; break; case (1): opts_.windowMag_ = 0.125; break; case (2): opts_.windowMag_ = 0.16; break; case (3): opts_.windowMag_ = 0.25; break; case (4): opts_.windowMag_ = 0.33; break; case (5): opts_.windowMag_ = 0.5; break; case (6): opts_.windowMag_ = 0.75; break; case (7): opts_.windowMag_ = 1.0; break; case (8): opts_.windowMag_ = 1.5; break; case (9): opts_.windowMag_ = 2.0; break; case (10): opts_.windowMag_ = 3.0; break; case (11): opts_.windowMag_ = 4.0; break; case (12): opts_.windowMag_ = 6.0; break; } } }); getContentPane().add(prefZoomCombo); springLayout.putConstraint( SpringLayout.NORTH, prefZoomCombo, 30, SpringLayout.NORTH, closeOnExitCheckBox); springLayout.putConstraint( SpringLayout.WEST, prefZoomCombo, 90, SpringLayout.WEST, autoreloadDevicesCheckBox); JLabel prefZoomLabel = new JLabel("Preferred image window zoom:"); getContentPane().add(prefZoomLabel); springLayout.putConstraint( SpringLayout.EAST, prefZoomLabel, 0, SpringLayout.WEST, prefZoomCombo); springLayout.putConstraint( SpringLayout.WEST, prefZoomLabel, 20, SpringLayout.WEST, getContentPane()); springLayout.putConstraint( SpringLayout.NORTH, prefZoomLabel, 0, SpringLayout.NORTH, prefZoomCombo); }