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); }
/** 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
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); }
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); }
/** * 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; }