protected void renderValue(MultiValueResolutionDecision decision) { model.removeAllElements(); switch (decision.getDecisionType()) { case UNDECIDED: model.addElement(tr("Choose a value")); cbDecisionRenderer.setFont(getFont().deriveFont(Font.ITALIC)); cbDecisionRenderer.setSelectedIndex(0); break; case KEEP_ONE: model.addElement(decision.getChosenValue()); cbDecisionRenderer.setFont(getFont()); cbDecisionRenderer.setSelectedIndex(0); break; case KEEP_NONE: model.addElement(tr("deleted")); cbDecisionRenderer.setFont(getFont().deriveFont(Font.ITALIC)); cbDecisionRenderer.setSelectedIndex(0); break; case KEEP_ALL: model.addElement(decision.getChosenValue()); cbDecisionRenderer.setFont(getFont()); cbDecisionRenderer.setSelectedIndex(0); break; } }
/** * Constructs an SQLPanel using a given annotation for the 'ref' part of the URL (the part after * the '#' character). * * @param refString the string used for annotating * @param refArea true to use a multi-line text area for the ref field, false for a one-line field */ public SQLPanel(String refString, boolean refArea) { super(new BorderLayout()); stack = new LabelledComponentStack(); add(stack, BorderLayout.NORTH); Font inputFont = stack.getInputFont(); /* Protocol input field. */ protoField = new JComboBox(); protoField.addItem(""); protoField.addItem("mysql"); protoField.addItem("postgresql"); protoField.setEditable(true); protoField.setFont(inputFont); stack.addLine("Protocol", "jdbc:", protoField); /* Host input field. */ hostField = new JComboBox(); hostField.addItem(""); hostField.addItem("localhost"); hostField.setEditable(true); hostField.setFont(inputFont); stack.addLine("Host", "://", hostField); /* Database field. */ dbField = new JTextField(12); stack.addLine("Database name", "/", dbField); /* Reference field in the one-line case. */ if (!refArea) { refField = new JTextField(32); stack.addLine(refString, "#", refField); } /* Username input field. */ userField = new JTextField(12); userField.setText(System.getProperty("user.name")); stack.addLine("User name", null, userField); /* Password input field. */ passField = new JPasswordField(12); stack.addLine("Password", null, passField); /* Reference field in the multi-line case. */ if (refArea) { JComponent refHolder = new JPanel(new BorderLayout()); Box labelBox = Box.createVerticalBox(); labelBox.add(new JLabel(refString + ": # ")); labelBox.add(Box.createVerticalGlue()); refHolder.add(labelBox, BorderLayout.WEST); refField = new JTextArea(); refField.setFont(Font.decode("Monospaced")); refHolder.add(Box.createVerticalStrut(5), BorderLayout.NORTH); refHolder.add(new JScrollPane(refField), BorderLayout.CENTER); refHolder.setPreferredSize(new Dimension(400, 100)); add(refHolder, BorderLayout.CENTER); } }
private void jbInit() throws Exception { this.setResizable(false); this.setSize(new Dimension(460, 440)); this.getContentPane().setLayout(null); jScrollPane1.setBounds(new Rectangle(35, 135, 380, 160)); jLabel1.setText("Enter ID"); jLabel1.setBounds(new Rectangle(35, 35, 105, 20)); jCBselectStudent.setBounds(new Rectangle(175, 30, 230, 20)); jCBselectStudent.setFont(new Font("Times New Roman", 0, 12)); jLabel2.setText("Students List"); jLabel2.setBounds(new Rectangle(35, 110, 80, 15)); jCBselectCourse.setBounds(new Rectangle(175, 65, 230, 20)); jCBselectCourse.setFont(new Font("Times New Roman", 0, 12)); jCBselectCourse.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jCBselectCourse_actionPerformed(e); } }); jLabel4.setText("Select Course"); jLabel4.setBounds(new Rectangle(35, 65, 80, 20)); jSeparator1.setBounds(new Rectangle(0, 95, 465, 5)); jButton1.setText("Register"); jButton1.setBounds(new Rectangle(290, 335, 125, 35)); jButton1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); jButton2.setText("Back"); jButton2.setBounds(new Rectangle(35, 340, 125, 35)); jButton2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jButton2_actionPerformed(e); } }); fillComboBoxes(); this.getContentPane().add(jButton2, null); this.getContentPane().add(jButton1, null); this.getContentPane().add(jSeparator1, null); this.getContentPane().add(jLabel4, null); this.getContentPane().add(jCBselectCourse, null); this.getContentPane().add(jLabel2, null); this.getContentPane().add(jCBselectStudent, null); this.getContentPane().add(jLabel1, null); jScrollPane1.getViewport().add(jTAstudentList, null); this.getContentPane().add(jScrollPane1, null); jTAstudentList.setFont(new Font("Times New Roman", 0, 12)); this.setLocationRelativeTo(null); this.setVisible(true); }
MsMsBottomPanel(MsMsVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) { this.dataFile = dataFile; this.masterFrame = masterFrame; setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBackground(Color.white); setBorder(new EmptyBorder(5, 5, 5, 0)); add(Box.createHorizontalGlue()); GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT); thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values()); thresholdCombo.setSelectedItem(PeakThresholdMode.NONE); thresholdCombo.setBackground(Color.white); thresholdCombo.setFont(smallFont); thresholdCombo.addActionListener(this); add(thresholdCombo); JPanel peakThresholdPanel = new JPanel(); peakThresholdPanel.setBackground(Color.white); peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS)); GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT); peakTextField = new JTextField(); peakTextField.setPreferredSize(new Dimension(50, 15)); peakTextField.setFont(smallFont); peakTextField.addActionListener(this); peakThresholdPanel.add(peakTextField); add(peakThresholdPanel); GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT); peakListSelector = new JComboBox<PeakList>(); peakListSelector.setBackground(Color.white); peakListSelector.setFont(smallFont); peakListSelector.addActionListener(masterFrame); peakListSelector.setActionCommand("PEAKLIST_CHANGE"); add(peakListSelector); thresholdSettings = parameters.getParameter(MsMsParameters.peakThresholdSettings); thresholdCombo.setSelectedItem(thresholdSettings.getMode()); add(Box.createHorizontalStrut(10)); add(Box.createHorizontalGlue()); }
public TeamEntry(ITeam team, int relatedTeam) { setLayout( new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); setBorder( new CompoundBorder( UIManager.getBorder("TitledBorder.aquaVariant"), new EmptyBorder(0, 5, 0, 5))); { JLabel lblTeamname = new JLabel("TeamName"); if (team != null) { this.team = team; lblTeamname.setText(team.getName()); } lblTeamname.setFont(new Font("Lucida Grande", Font.PLAIN, 11)); add(lblTeamname, "2, 2, right, default"); } { comboBox = new JComboBox(); comboBox.setFont(new Font("Lucida Grande", Font.PLAIN, 11)); comboBox.setModel(new DefaultComboBoxModel(new String[] {"Red", "Yellow", "Green", "Blue"})); if (relatedTeam >= 0 && relatedTeam < 4) { comboBox.setSelectedIndex(relatedTeam); } add(comboBox, "4, 2, fill, default"); } }
public GlobalControls() { setLayout(new GridBagLayout()); setBorder(new TitledBorder(new EtchedBorder(), "Global Controls")); aliasCB = createCheckBox("Anti-Aliasing", true, 0); renderCB = createCheckBox("Rendering Quality", false, 1); textureCB = createCheckBox("Texture", false, 2); compositeCB = createCheckBox("AlphaComposite", false, 3); screenCombo = new JComboBox(); screenCombo.setPreferredSize(new Dimension(120, 18)); screenCombo.setLightWeightPopupEnabled(true); screenCombo.setFont(font); for (int i = 0; i < screenNames.length; i++) { screenCombo.addItem(screenNames[i]); } screenCombo.addItemListener(this); Java2Demo.addToGridBag(this, screenCombo, 0, 4, 1, 1, 0.0, 0.0); toolBarCB = createCheckBox("Tools", false, 5); slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 30); slider.addChangeListener(this); TitledBorder tb = new TitledBorder(new EtchedBorder()); tb.setTitleFont(font); tb.setTitle("Anim delay = 30 ms"); slider.setBorder(tb); slider.setMinimumSize(new Dimension(80, 46)); Java2Demo.addToGridBag(this, slider, 0, 6, 1, 1, 1.0, 1.0); texturechooser = new TextureChooser(0); Java2Demo.addToGridBag(this, texturechooser, 0, 7, 1, 1, 1.0, 1.0); }
/** * Creates the language combo box, attempts to guess an appropriate *available* locale to select, * and sets the application locale to that match. */ private JComboBox createLanguageDropDown(Font normalFont) { final JComboBox languageDropDown = new JComboBox(); Locale[] locales = LanguageUtils.getLocales(normalFont); languageDropDown.setRenderer(new LocaleRenderer()); languageDropDown.setFont(smallFont); languageDropDown.setModel(new DefaultComboBoxModel(locales)); // Attempt to guess the default locale and set accordingly languageDropDown.setSelectedItem(LanguageUtils.guessBestAvailableLocale(locales)); // Make sure the drop down and the set locale match. This may cause the default OS // language to be overridden to English in the case of a bad guess. This has always been // a problem but in this case at least it will be obvious that the users language is being // overridden. LanguageUtils.setLocale((Locale) languageDropDown.getSelectedItem()); languageDropDown.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Locale locale = (Locale) languageDropDown.getSelectedItem(); LanguageUtils.setLocale(locale); setTextContents(); } } }); return languageDropDown; }
/** Called when the user presses the + button. Does not allow to add more than 26 boxes. */ private void addImageBox() { if (n_image_box >= 26) return; char c = (char) ('A' + n_image_box); final JLabel label = new JLabel(String.valueOf(c) + ":"); jPanelImages.add(label); final JComboBox combo_box = new JComboBox(image_names); jPanelImages.add(combo_box); combo_box.setSelectedIndex(Math.min(n_image_box, image_names.length - 1)); final int width = jPanelImages.getWidth(); label.setBounds(10, 10 + BOX_SPACE * n_image_box, 20, 25); combo_box.setBounds(30, 10 + BOX_SPACE * n_image_box, width - 50, 30); combo_box.setFont(new Font("Arial", Font.PLAIN, 10)); combo_box.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { checkValid(); } }); labels.add(label); image_boxes.add(combo_box); jPanelImages.setPreferredSize(new Dimension(width, 50 + BOX_SPACE * n_image_box)); n_image_box++; refreshVariableList(); checkValid(); if (n_image_box >= 26) { jButtonPlus.setEnabled(false); } if (n_image_box > 1) { jButtonMinus.setEnabled(true); } }
public void refreshSupplier(boolean remove) { if (remove) panel.remove(supplierCombo); try { model = new DefaultComboBoxModel( Manager.getInstance().getSupplierManager().getSuppliers().toArray()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } supplierCombo = new JComboBox(model); supplierCombo.setUI(ColorArrowUI.createUI(this)); supplierCombo.setEditable(true); supplierComboField = (JTextField) supplierCombo.getEditor().getEditorComponent(); supplierComboField.setText(""); supplierComboField.setOpaque(false); supplierComboField.setBorder(BorderFactory.createEmptyBorder()); supplierComboField.addKeyListener(new ComboKeyHandler(supplierCombo)); supplierCombo.setFont(new Font("Arial Narrow", Font.PLAIN, 14)); supplierCombo.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK)); supplierCombo.setOpaque(false); supplierCombo.setSelectedIndex(-1); supplierCombo.setVisible(supplierLabel.isVisible()); supplierCombo.setBounds(85, 56, 220, 20); panel.add(supplierCombo); }
public DemoControls(ImageOps demo) { super(demo.name); this.demo = demo; setBackground(Color.gray); add(imgCombo = new JComboBox()); imgCombo.setFont(font); for (int i = 0; i < ImageOps.imgName.length; i++) { imgCombo.addItem(ImageOps.imgName[i]); } imgCombo.addActionListener(this); add(opsCombo = new JComboBox()); opsCombo.setFont(font); for (int i = 0; i < ImageOps.opsName.length; i++) { opsCombo.addItem(ImageOps.opsName[i]); } opsCombo.addActionListener(this); }
public void init() { this.setPreferredSize(new Dimension(500, 500)); this.setMinimumSize(new Dimension(500, 500)); this.setLocationRelativeTo(null); this.setUndecorated(true); this.pack(); this.toFront(); this.setLayout(new GridLayout(2, 1, 0, 0)); panelSuperior = new JPanel(new GridLayout(4, 1, 0, 0)); usuario = new JLabel(accion); usuario.setHorizontalAlignment(JLabel.CENTER); usuario.setFont(new Font("Arial", 0, 20)); usuario.setOpaque(true); usuario.setBackground(Color.BLACK); usuario.setForeground(Color.white); this.cargo = new JLabel("SESION " + puesto); cargo.setHorizontalAlignment(JLabel.CENTER); cargo.setFont(new Font("Arial", 0, 36)); cargo.setOpaque(true); cargo.setBackground(Color.BLACK); cargo.setForeground(Color.white); this.cargo = new JLabel("CARGO"); cargo.setHorizontalAlignment(JLabel.CENTER); cargo.setFont(new Font("Arial", 0, 36)); cargo.setOpaque(true); cargo.setBackground(Color.BLACK); cargo.setForeground(Color.white); this.usuarioIn = new JTextField(); usuarioIn.setEditable(false); usuarioIn.setFont(new Font("Arial", 0, 36)); usuarioIn.setOpaque(true); usuarioIn.setBackground(Color.GREEN); usuarioIn.setText(""); String[] puestos = {"Cajero", "Supervisor", "Gerente", "Admin"}; cargoIn = new JComboBox<>(puestos); cargoIn.setFont(new Font("Arial", 0, 20)); this.teclado = new TecladoPass(); this.panelSuperior.add(cargo); this.panelSuperior.add(usuario); this.panelSuperior.add(usuarioIn); this.panelSuperior.add(cargo); this.panelSuperior.add(cargoIn); this.add(panelSuperior); this.add(teclado); this.setVisible(true); }
private JComboBox<DeckType> getDeckTypeComboBox() { final JComboBox<DeckType> cbo = new JComboBox<>(); cbo.setModel(new DefaultComboBoxModel<>(DeckType.values())); cbo.setLightWeightPopupEnabled(false); cbo.setFocusable(false); cbo.setFont(FontsAndBorders.FONT2); ((JLabel) cbo.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER); return cbo; }
public void p(Object obj) throws Exception { JComboBox combo = (JComboBox) obj; combo.setFont(combo.getFont().deriveFont(Font.PLAIN)); combo.setBackground(Color.WHITE); if (color == null) color = DEFAULT_COLOR; if (font == null) font = DEFAULT_FONT; combo.setRenderer(new ListRenderer1(icon, color, font)); }
public static JComboBox getComboBox() { JComboBox component = new JComboBox(); component.setBackground(BACKGROUND_COLOR_TXTA); component.setForeground(TEXT_COLOR); component.setCursor(CURSOR); component.setFont(FONT_TYPE_TXTA); return component; }
/** * This method is invoked when the user clicks away from the target selection dropdown menu. It * behaves as more of a feature than a necessary part of the system; canceling the selection * functions like a reset button for the current item. It removes the lock from the previously * selected target, allowing systems to be selected in other dropdowns which are not compatible * with the current system (thus leading to its replacement). */ @Override public void popupMenuCanceled(PopupMenuEvent e) { JComboBox changedSystem = (JComboBox) e.getSource(); String current = targets.get(changedSystem); // Get the category of the changed system if (current == null) return; userPicks.remove(current); // Clear the lock on this system changedSystem.setFont(changedSystem.getFont().deriveFont(Font.PLAIN)); // Unbold the box populateTargets(); // Re-populate our combo boxes to reflect that they no longer need to // fill this system's dependencies }
private void initializeField() { field.addItemListener( new java.awt.event.ItemListener() { @Override public void itemStateChanged(java.awt.event.ItemEvent evt) { fieldItemStateChanged(evt); } }); field.setFont(new Font("Arial", Font.ITALIC, 9)); field.setBorder(null); }
@Override public void setFont(final Font font) { super.setFont(font); if (cboDisplayType == null) { return; } cboDisplayType.setFont(font); cmdSave.setFont(font); cmdUnzoom.setFont(font); cmdResetView.setFont(font); cmdMaximize.setFont(font); spnBins.setFont(font); lblBins.setFont(font); }
private void setupLayout() { setBackground(new Color(70, 130, 180)); anotherBox.setBackground(new Color(176, 196, 222)); pictureBox.setBackground(new Color(176, 196, 222)); anotherBox.setFont(new Font("Baskerville", Font.PLAIN, 13)); saveButton.setFont(new Font("Baskerville", Font.PLAIN, 13)); pictureBox.setFont(new Font("Baskerville", Font.PLAIN, 13)); loadButton.setFont(new Font("Baskerville", Font.PLAIN, 13)); layout.putConstraint(SpringLayout.SOUTH, pictureBox, 0, SpringLayout.SOUTH, anotherBox); layout.putConstraint(SpringLayout.NORTH, pictureBox, 0, SpringLayout.NORTH, anotherBox); layout.putConstraint(SpringLayout.EAST, pictureBox, 159, SpringLayout.EAST, anotherBox); layout.putConstraint(SpringLayout.NORTH, saveButton, 15, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.NORTH, payne, 25, SpringLayout.SOUTH, saveButton); layout.putConstraint(SpringLayout.WEST, saveButton, 25, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.WEST, payne, 25, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, btnNewButton, 15, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, btnNewButton, 25, SpringLayout.EAST, pictureBox); layout.putConstraint(SpringLayout.WEST, pictureBox, 25, SpringLayout.EAST, anotherBox); layout.putConstraint(SpringLayout.NORTH, loadButton, 15, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, loadButton, 25, SpringLayout.EAST, saveButton); layout.putConstraint(SpringLayout.NORTH, anotherBox, 15, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, anotherBox, 25, SpringLayout.EAST, loadButton); }
/** * Contruct a new AnimationWidget. * * @param parentf the parent JFrame * @param anim a ucar.visad.display.Animation object to manage * @param info Default values for the AnimationInfo */ public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info) { // Initialize sharing to true super("AnimationWidget", true); timesCbx = new JComboBox() { public String getToolTipText(MouseEvent event) { if (boxPanel != null) { return boxPanel.getToolTipText(); } return " "; } }; timesCbx.setToolTipText(""); timesCbxMutex = timesCbx.getTreeLock(); timesCbx.setFont(new Font("Dialog", Font.PLAIN, 9)); timesCbx.setLightWeightPopupEnabled(false); // set to non-visible until items are added timesCbx.setVisible(false); timesCbx.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (!ignoreTimesCbxEvents && (anime != null)) { debug("got timesCbx event"); setTimeFromUser((Real) timesCbx.getSelectedItem()); if (boxPanel != null) { boxPanel.setOnIndex(timesCbx.getSelectedIndex()); } } } }); animationInfo = new AnimationInfo(); if (anim != null) { setAnimation(anim); } if (anime != null) { animationInfo.set(anime.getAnimationInfo()); } if (info != null) { setProperties(info); animationInfo.setRunning(info.getRunning()); } boxPanel = new AnimationBoxPanel(this); if (timesArray != null) { updateBoxPanel(timesArray); } }
private void setYearComboBox(Calendar c) { int y = c.get(Calendar.YEAR); years = new Integer[7]; for (int i = y - 3, j = 0; i <= y + 3; i++, j++) { years[j] = new Integer(i); } if (yearBox == null) { yearBox = new JComboBox(); yearBox.addActionListener(this); yearBox.setFont(DatePicker.plain); yearBox.setSize(yearBox.getWidth(), height); yearBox.setPreferredSize(new Dimension(yearBox.getWidth(), height)); } yearBox.setModel(new DefaultComboBoxModel(years)); yearBox.setSelectedItem(years[3]); }
JPanel bottomPanel() { bot.setLayout(new BoxLayout(bot, BoxLayout.X_AXIS)); bot.setBackground(COLOR); menu.setFont(DLOG); bot.add(menu); bot.add(Box.createHorizontalStrut(scaled(GAP))); stop.setFont(DLOG); bot.add(stop); bot.add(Box.createHorizontalGlue()); who.setForeground(Color.black); who.setFont(BOLD); bot.add(who); return bot; }
private void setMonthComboBox(Calendar c) { if (months == null) { months = new String[12]; for (int i = 0; i < 12; i++) { String m = parent.getString("month." + i, ""); months[i] = m; } } if (monthBox == null) { monthBox = new JComboBox(); monthBox.addActionListener(this); monthBox.setFont(DatePicker.plain); monthBox.setSize(monthBox.getWidth(), height); monthBox.setPreferredSize(new Dimension(monthBox.getWidth(), height)); } monthBox.setModel(new DefaultComboBoxModel(months)); monthBox.setSelectedIndex(c.get(Calendar.MONTH)); }
/** * Constructeur de la classe * * @param numJoueur rang du joueur dans la liste des joueurs */ public CadranSaisieInfoOrdinateur(int numJoueur) { this.setOpaque(false); this.setLayout(null); imageCadran.setIcon( new ImageIcon(getClass().getResource("/CadranJoueur" + numJoueur + ".png"))); this.add(imageCadran); imageCadran.setBounds(0, 0, 160, 150); strategie.setOpaque(false); strategie.setFont(new java.awt.Font("Wawati SC", 0, 13)); strategie.setBounds(3, 112, 150, 33); this.add(strategie, 0); strategie.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"Agressif", "Agressif avec Bluff", "Normal", "Passif"})); }
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(); }
/** Name: initGUI() Precondition(s): none PostCondition(s): Initializes the window. */ private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("Edit Course"); getContentPane().setLayout(null); { lblName = new JLabel(); getContentPane().add(lblName); lblName.setText("Name"); lblName.setBounds(10, 11, 40, 17); lblName.setFont(new java.awt.Font("Tahoma", 0, 14)); } { ComboBoxModel cbxNameModel = new DefaultComboBoxModel(new String[] {"CMSC 202", "CMSC 203"}); cbxName = new JComboBox(); getContentPane().add(cbxName); cbxName.setModel(cbxNameModel); cbxName.setBounds(115, 11, 149, 20); cbxName.setFont(new java.awt.Font("Tahoma", 0, 14)); } { lblSemester = new JLabel(); getContentPane().add(lblSemester); lblSemester.setText("Semester"); lblSemester.setBounds(10, 39, 105, 14); lblSemester.setFont(new java.awt.Font("Tahoma", 0, 14)); } { ComboBoxModel cbxSemesterModel = new DefaultComboBoxModel(new String[] {"Fall 2009", "Spring 2010 "}); cbxSemester = new JComboBox(); getContentPane().add(cbxSemester); cbxSemester.setModel(cbxSemesterModel); cbxSemester.setBounds(115, 38, 149, 20); cbxSemester.setFont(new java.awt.Font("Tahoma", 0, 14)); } { lblGrade = new JLabel(); getContentPane().add(lblGrade); lblGrade.setText("Grade"); lblGrade.setBounds(10, 64, 63, 14); lblGrade.setFont(new java.awt.Font("Tahoma", 0, 14)); } { ComboBoxModel cbxGradeModel = new DefaultComboBoxModel(new String[] {"A", "B"}); cbxGrade = new JComboBox(); getContentPane().add(cbxGrade); cbxGrade.setModel(cbxGradeModel); cbxGrade.setBounds(115, 63, 65, 20); cbxGrade.setFont(new java.awt.Font("Tahoma", 0, 14)); } { lblComments = new JLabel(); getContentPane().add(lblComments); lblComments.setText("Comments"); lblComments.setBounds(10, 89, 100, 14); lblComments.setFont(new java.awt.Font("Tahoma", 0, 14)); } { txtComments = new JTextArea(); scrollpaneComments = new JScrollPane(txtComments); getContentPane().add(scrollpaneComments); scrollpaneComments.setBounds(114, 94, 230, 119); } { cmdSave = new JButton(); getContentPane().add(cmdSave); cmdSave.setText("Save"); cmdSave.setBounds(124, 228, 88, 23); cmdSave.setFont(new java.awt.Font("Tahoma", 0, 14)); cmdSave.addActionListener(this); } pack(); this.setSize(370, 300); } catch (Exception e) { e.printStackTrace(); } }
public void setLayout() { setLayout(new GridBagLayout()); setBorder(BorderFactory.createEtchedBorder()); Dimension d = getPreferredSize(); d.height = 400; controllerb = new ControllerForBookingDetails(); timer = new Timer( 1000, new ActionListener() { public void actionPerformed(ActionEvent w) { reloadfirst(); } }); timerLog = new Timer( 1000, new ActionListener() { public void actionPerformed(ActionEvent w) { reloadLog(); } }); timer.start(); timerLog.start(); tableModel = new CenterPanelTableModel(); table = new JTable(tableModel); Font f = CustomFont.setFontTahomaPlain(); Font fbold = CustomFont.setFontTahomaBold(); controllerl = new ControllerForLogs(); panelSearch = new JPanel(); panelSearch.setLayout(new FlowLayout(FlowLayout.LEFT)); panelTable = new JPanel(); panelTable.setLayout(new BorderLayout()); panelTable.setPreferredSize(d); panelTxt = new JPanel(); panelTxt.setLayout(new BorderLayout()); panelCenter = new JPanel(); panelCenter.setLayout(new BorderLayout()); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getTableHeader().setReorderingAllowed(false); table.getTableHeader().setResizingAllowed(true); table.setRowHeight(20); table.getTableHeader().setFont(fbold); table.setFont(f); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); TableColumnModel tcm = table.getColumnModel(); tcm.getColumn(0).setPreferredWidth(400); tcm.getColumn(1).setPreferredWidth(150); tcm.getColumn(2).setPreferredWidth(300); tcm.getColumn(3).setPreferredWidth(300); tcm.getColumn(4).setPreferredWidth(100); tcm.getColumn(5).setPreferredWidth(400); tcm.getColumn(6).setPreferredWidth(150); tcm.getColumn(7).setPreferredWidth(150); typemod = new DefaultComboBoxModel<String>(); typemod.addElement("First Name"); typemod.addElement("Last Name"); typemod.addElement("Name of Event"); typemod.addElement("Type of Event"); typemod.addElement("Date"); typemod.addElement("Location"); cboType = new JComboBox<String>(); cboType.setModel(typemod); cboType.setFont(f); txtSearch = new JTextField(40); txtSearch.setFont(f); btnEditnotice = new JButton("Edit Notice Board"); btnEvent = new JButton("Today's Event"); btnRefresh = new JButton("Refresh"); btnEditnotice.setFont(f); btnRefresh.setFont(f); btnEvent.setFont(f); panelSearch.add(txtSearch); panelSearch.add(cboType); panelSearch.add(btnRefresh); panelSearch.add(btnEvent); panelSearch.add(btnEditnotice); popMain = new JPopupMenu(); mniPackage = new JMenuItem("Show Complete Details for this Booking"); txtLog = new JTextArea(7, 30); txtLog.setFont(CustomFont.setFontTahomaPlain()); txtLog.setBackground(CustomColor.bgColor()); txtLog.setEditable(false); popMain.add(mniPackage); loadfirst(); loadLog(); }
/** * 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; }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ private void initComponents() { lbTableName = new javax.swing.JLabel(); tfTableName = new javax.swing.JTextField(); lbTableType = new javax.swing.JLabel(); cbTableType = new javax.swing.JComboBox(); lbFields = new javax.swing.JLabel(); tfFieldName = new javax.swing.JTextField(); btAdd = new javax.swing.JButton(); lbFieldProp = new javax.swing.JLabel(); lbFieldType = new javax.swing.JLabel(); cbFieldType = new javax.swing.JComboBox(); lbFieldLength = new javax.swing.JLabel(); tfFieldLength = new javax.swing.JTextField(); lbDefault = new javax.swing.JLabel(); tfDefault = new javax.swing.JTextField(); chPrimary = new javax.swing.JCheckBox(); chIndex = new javax.swing.JCheckBox(); chUnique = new javax.swing.JCheckBox(); chBinary = new javax.swing.JCheckBox(); chNotNull = new javax.swing.JCheckBox(); chUnsigned = new javax.swing.JCheckBox(); chAuto = new javax.swing.JCheckBox(); chZeroFill = new javax.swing.JCheckBox(); listFields = new javax.swing.JList(new DefaultListModel()); btCreateTable = new javax.swing.JButton(); btRemove = new javax.swing.JButton(); btCancel = new javax.swing.JButton(); jd = new JDialog( _session.getApplication().getMainFrame(), // i18n[mysql.createTableComm=Create Table...] s_stringMgr.getString("mysql.createTableComm")); jd.getContentPane().setLayout(null); addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); // i18n[mysql.tableNamelbl=Table Name:] lbTableName.setText(s_stringMgr.getString("mysql.tableNamelbl")); jd.getContentPane().add(lbTableName); lbTableName.setBounds(20, 30, 70, 16); tfTableName.setText("TableName"); jd.getContentPane().add(tfTableName); tfTableName.setBounds(120, 30, 100, 20); lbTableType.setFont(new java.awt.Font("Dialog", 0, 12)); lbTableType.setText("Table Type:"); jd.getContentPane().add(lbTableType); lbTableType.setBounds(20, 60, 70, 16); cbTableType.setFont(new java.awt.Font("Dialog", 0, 12)); cbTableType.setModel( new javax.swing.DefaultComboBoxModel( new String[] {"<Automatic>", "ISAM", "MyISAM", "MERGE", "InnoDb", "HEAP", "BDB"})); jd.getContentPane().add(cbTableType); cbTableType.setBounds(120, 60, 100, 20); lbFields.setText("Fields:"); lbFields.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1))); jd.getContentPane().add(lbFields); lbFields.setBounds(10, 120, 40, 18); tfFieldName.setText("FieldName"); tfFieldName.addFocusListener( new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { tfFieldNameFocusGained(evt); } }); jd.getContentPane().add(tfFieldName); tfFieldName.setBounds(10, 150, 110, 20); btAdd.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.createAdd=Add] btAdd.setText(s_stringMgr.getString("mysql.createAdd")); btAdd.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btAddActionPerformed(evt); } }); jd.getContentPane().add(btAdd); btAdd.setBounds(130, 150, 80, 26); // i18n[mysql.fieldProps=Field Properties:] lbFieldProp.setText(s_stringMgr.getString("mysql.fieldProps")); lbFieldProp.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1))); jd.getContentPane().add(lbFieldProp); lbFieldProp.setBounds(220, 150, 100, 20); lbFieldType.setFont(new java.awt.Font("Dialog", 0, 12)); lbFieldType.setText("Type"); jd.getContentPane().add(lbFieldType); lbFieldType.setBounds(220, 190, 41, 16); cbFieldType.setFont(new java.awt.Font("Dialog", 0, 12)); cbFieldType.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT", "FLOAT", "DOUBLE", "DECIMAL", "DATE", "DATETIME", "TIMESTAMP", "TIME", "YEAR", "CHAR", "VARCHAR", "TINYBLOB", "TINYTEXT", "TEXT", "BLOB", "MEDIUMBLOB", "MEDIUMTEXT", "LONGBLOB", "LONGTEXT", "ENUM", "SET" })); cbFieldType.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbFieldTypeActionPerformed(evt); } }); jd.getContentPane().add(cbFieldType); cbFieldType.setBounds(300, 190, 110, 20); lbFieldLength.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.lengtSet=Length/Set] lbFieldLength.setText(s_stringMgr.getString("mysql.lengtSet")); jd.getContentPane().add(lbFieldLength); lbFieldLength.setBounds(220, 220, 70, 16); jd.getContentPane().add(tfFieldLength); tfFieldLength.setBounds(300, 220, 110, 20); lbDefault.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.defaultValue=Default Value] lbDefault.setText(s_stringMgr.getString("mysql.defaultValue")); jd.getContentPane().add(lbDefault); lbDefault.setBounds(220, 250, 80, 16); jd.getContentPane().add(tfDefault); tfDefault.setBounds(300, 250, 110, 20); chPrimary.setFont(new java.awt.Font("Dialog", 0, 12)); chPrimary.setText("Primary"); chPrimary.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { chPrimaryItemStateChanged(evt); } }); jd.getContentPane().add(chPrimary); chPrimary.setBounds(220, 290, 67, 20); chIndex.setFont(new java.awt.Font("Dialog", 0, 12)); chIndex.setText("Index"); jd.getContentPane().add(chIndex); chIndex.setBounds(290, 290, 54, 20); chUnique.setFont(new java.awt.Font("Dialog", 0, 12)); chUnique.setText("Unique"); jd.getContentPane().add(chUnique); chUnique.setBounds(350, 290, 65, 20); chBinary.setFont(new java.awt.Font("Dialog", 0, 12)); chBinary.setText("Binary"); jd.getContentPane().add(chBinary); chBinary.setBounds(220, 320, 70, 20); chNotNull.setFont(new java.awt.Font("Dialog", 0, 12)); chNotNull.setText("Not Null"); jd.getContentPane().add(chNotNull); chNotNull.setBounds(290, 320, 70, 20); chUnsigned.setFont(new java.awt.Font("Dialog", 0, 12)); chUnsigned.setText("Unsigned"); jd.getContentPane().add(chUnsigned); chUnsigned.setBounds(360, 320, 80, 20); chAuto.setFont(new java.awt.Font("Dialog", 0, 12)); chAuto.setText("Auto Increment"); jd.getContentPane().add(chAuto); chAuto.setBounds(220, 350, 110, 20); chZeroFill.setFont(new java.awt.Font("Dialog", 0, 12)); chZeroFill.setText("Zero Fill"); jd.getContentPane().add(chZeroFill); chZeroFill.setBounds(330, 350, 69, 20); listFields.addListSelectionListener( new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { listFieldsValueChanged(evt); } }); JScrollPane scrollPane = new JScrollPane(listFields); jd.getContentPane().add(scrollPane); scrollPane.setBounds(10, 190, 110, 150); btCreateTable.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.createTableBtn=Create table] btCreateTable.setText(s_stringMgr.getString("mysql.createTableBtn")); btCreateTable.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btCreateTableActionPerformed(evt); } }); jd.getContentPane().add(btCreateTable); btCreateTable.setBounds(221, 380, 110, 26); btRemove.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.btRemove=Remove] btRemove.setText(s_stringMgr.getString("mysql.btRemove")); btRemove.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btRemoveActionPerformed(evt); } }); jd.getContentPane().add(btRemove); btRemove.setBounds(130, 190, 80, 26); btCancel.setFont(new java.awt.Font("Dialog", 0, 12)); // i18n[mysql.btCancel=Cancel] btCancel.setText(s_stringMgr.getString("mysql.btCancel")); btCancel.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btCancelActionPerformed(evt); } }); jd.getContentPane().add(btCancel); btCancel.setBounds(340, 380, 73, 26); jd.pack(); jd.setSize(450, 450); jd.setLocation(100, 100); jd.setVisible(true); }