@Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { textLabel.setFont(table.getFont()); textLabel.setText(Objects.toString(value, "")); textLabel.setBorder(hasFocus ? focusCellHighlightBorder : noFocusBorder); FontMetrics fm = table.getFontMetrics(table.getFont()); Insets i = textLabel.getInsets(); int swidth = iconLabel.getPreferredSize().width + fm.stringWidth(textLabel.getText()) + i.left + i.right; int cwidth = table.getColumnModel().getColumn(column).getWidth(); dim.width = swidth > cwidth ? cwidth : swidth; if (isSelected) { textLabel.setOpaque(true); textLabel.setForeground(table.getSelectionForeground()); textLabel.setBackground(table.getSelectionBackground()); iconLabel.setIcon(sicon); } else { textLabel.setOpaque(false); textLabel.setForeground(table.getForeground()); textLabel.setBackground(table.getBackground()); iconLabel.setIcon(nicon); } return panel; }
public TestPanel3() { super(); contentPanel = getContentPanel(); ImageIcon icon = getImageIcon(); titlePanel = new javax.swing.JPanel(); textLabel = new javax.swing.JLabel(); iconLabel = new javax.swing.JLabel(); separator = new javax.swing.JSeparator(); setLayout(new java.awt.BorderLayout()); titlePanel.setLayout(new java.awt.BorderLayout()); titlePanel.setBackground(Color.gray); textLabel.setBackground(Color.gray); textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14)); textLabel.setText("Pretending To Connect To Server"); textLabel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10))); textLabel.setOpaque(true); iconLabel.setBackground(Color.gray); if (icon != null) iconLabel.setIcon(icon); titlePanel.add(textLabel, BorderLayout.CENTER); titlePanel.add(iconLabel, BorderLayout.EAST); titlePanel.add(separator, BorderLayout.SOUTH); add(titlePanel, BorderLayout.NORTH); JPanel secondaryPanel = new JPanel(); secondaryPanel.add(contentPanel, BorderLayout.NORTH); add(secondaryPanel, BorderLayout.WEST); }
public void createColorPanel() { JPanel colorPanel = new JPanel(new GridLayout(0, 1)); int curRow = 0; for (int i = 0; i < colorString.length / 5; i++) { JPanel row = new JPanel(new GridLayout(1, 0, 2, 1)); row.setBorder(new EmptyBorder(2, 2, 2, 2)); for (int j = curRow; j < curRow + 5; j++) { final JLabel colorLabel = new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER); colorLabel.setOpaque(true); final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1); final Border lnb = BorderFactory.createLineBorder(Color.black); final Border cmb = BorderFactory.createCompoundBorder(lnb, emb); colorLabel.setBorder(emb); colorLabel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton btn = (JButton) getTarget(); Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor(); btn.setIcon(new ColoredIcon(selColor)); setVisible(false); btn.doClick(); oldLabel.setBackground(null); colorLabel.setBackground(new Color(150, 150, 200)); colorLabel.setBorder(emb); oldLabel = colorLabel; } public void mouseEntered(MouseEvent e) { colorLabel.setBorder(cmb); colorLabel.setBackground(new Color(150, 150, 200)); } public void mouseExited(MouseEvent e) { colorLabel.setBorder(emb); colorLabel.setBackground(null); } }); row.add(colorLabel); } colorPanel.add(row); curRow += row.getComponentCount(); // System.out.println(curRow); } add(colorPanel, BorderLayout.CENTER); // More Colors Button moreColors = new JButton(new ColorChooserAction((JButton) target)); moreColors.setText("More Colors..."); moreColors.setIcon(null); moreColors.setFont(new Font("Verdana", Font.PLAIN, 10)); // JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(moreColors); add(c, BorderLayout.SOUTH); }
public CompoundTreeCellRenderer() { super(); Color bsColor = getBorderSelectionColor(); Color focusBGColor = new Color(~getBackgroundSelectionColor().getRGB()); hasFocusBorder = BorderFactory.createCompoundBorder(new DotBorder(focusBGColor, bsColor), innerBorder); icon.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2)); text.setBorder(emptyBorder); text.setOpaque(true); p.setOpaque(false); p.add(icon, BorderLayout.WEST); JPanel wrap = new JPanel(new GridBagLayout()); wrap.setOpaque(false); wrap.add(text); p.add(wrap); }
/** Implement this method in ListCellRenderer */ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Object[] pair = (Object[]) value; // Cast value into an array jlblCell.setOpaque(true); jlblCell.setIcon((ImageIcon) pair[0]); jlblCell.setText(pair[1].toString()); if (isSelected) { jlblCell.setForeground(list.getSelectionForeground()); jlblCell.setBackground(list.getSelectionBackground()); } else { jlblCell.setForeground(list.getForeground()); jlblCell.setBackground(list.getBackground()); } jlblCell.setBorder(cellHasFocus ? lineBorder : emptyBorder); return jlblCell; }
public Step2Panel(WizardData wzd) { super(wzd); contentPanel = getContentPanel(wzd); contentPanel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10))); ImageIcon icon = getImageIcon(); titlePanel = new javax.swing.JPanel(); textLabel = new javax.swing.JLabel(); iconLabel = new javax.swing.JLabel(); separator = new javax.swing.JSeparator(); setLayout(new java.awt.BorderLayout()); titlePanel.setLayout(new java.awt.BorderLayout()); titlePanel.setBackground(Color.gray); textLabel.setBackground(Color.gray); textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14)); textLabel.setText("Project Language Files"); textLabel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10))); textLabel.setOpaque(true); iconLabel.setBackground(Color.gray); if (icon != null) { iconLabel.setIcon(icon); } titlePanel.add(textLabel, BorderLayout.CENTER); titlePanel.add(iconLabel, BorderLayout.EAST); titlePanel.add(separator, BorderLayout.SOUTH); add(titlePanel, BorderLayout.NORTH); JPanel secondaryPanel = new JPanel(); secondaryPanel.add(contentPanel, BorderLayout.NORTH); add(secondaryPanel, BorderLayout.WEST); }
/** * Return a component that has been configured to display the specified value. * * @param list The JList we're painting. * @param value The value returned by list.getModel().getElementAt(index). * @param index The cells index. * @param isSelected True if the specified cell was selected. * @param cellHasFocus True if the specified cell has the focus. * @return A component whose paint() method will render the specified value. * @todo Implement this javax.swing.ListCellRenderer method */ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { HostItem hi = (HostItem) value; JLabel c = new JLabel(hi.name); if (isSelected && hi.eavesDroppingEnabled) { c.setBackground(Color.magenta); c.setForeground(list.getSelectionForeground()); } else if (!isSelected && hi.eavesDroppingEnabled) { c.setBackground(Color.red); c.setForeground(list.getForeground()); } else if (isSelected) { c.setBackground(list.getSelectionBackground()); c.setForeground(list.getSelectionForeground()); } else { c.setBackground(list.getBackground()); c.setForeground(list.getForeground()); } c.setEnabled(list.isEnabled()); c.setFont(list.getFont()); c.setOpaque(true); return c; }
/** This method is called from within the constructor to initialize the form. */ public void initComponents() { /** **************** The components ********************************* */ firstPanel = new JPanel(); firstPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 2)); // If put to False: we see the container's background firstPanel.setOpaque(false); // rows, columns, horizontalGap, verticalGap firstPanel.setLayout(new GridLayout(4, 2, 3, 3)); this.setLayout(new GridLayout(2, 1, 3, 3)); this.add(firstPanel); proxyStackNameLabel = new JLabel("Proxy stack name:"); proxyStackNameLabel.setToolTipText("The name of the stack to set"); // Alignment of the text proxyStackNameLabel.setHorizontalAlignment(AbstractButton.CENTER); // Color of the text proxyStackNameLabel.setForeground(Color.black); // Size of the text proxyStackNameLabel.setFont(new Font("Dialog", 1, 12)); // If put to true: we see the label's background proxyStackNameLabel.setOpaque(true); proxyStackNameLabel.setBackground(ProxyLauncher.labelBackGroundColor); proxyStackNameLabel.setBorder(ProxyLauncher.labelBorder); proxyStackNameTextField = new JTextField(20); proxyStackNameTextField.setHorizontalAlignment(AbstractButton.CENTER); proxyStackNameTextField.setFont(new Font("Dialog", 0, 14)); proxyStackNameTextField.setBackground(ProxyLauncher.textBackGroundColor); proxyStackNameTextField.setForeground(Color.black); proxyStackNameTextField.setBorder(BorderFactory.createLoweredBevelBorder()); firstPanel.add(proxyStackNameLabel); firstPanel.add(proxyStackNameTextField); proxyIPAddressLabel = new JLabel("Proxy IP address:"); proxyIPAddressLabel.setToolTipText("The address of the proxy to set"); // Alignment of the text proxyIPAddressLabel.setHorizontalAlignment(AbstractButton.CENTER); // Color of the text proxyIPAddressLabel.setForeground(Color.black); // Size of the text proxyIPAddressLabel.setFont(new Font("Dialog", 1, 12)); // If put to true: we see the label's background proxyIPAddressLabel.setOpaque(true); proxyIPAddressLabel.setBackground(ProxyLauncher.labelBackGroundColor); proxyIPAddressLabel.setBorder(ProxyLauncher.labelBorder); proxyIPAddressTextField = new JTextField(20); proxyIPAddressTextField.setHorizontalAlignment(AbstractButton.CENTER); proxyIPAddressTextField.setFont(new Font("Dialog", 0, 14)); proxyIPAddressTextField.setBackground(ProxyLauncher.textBackGroundColor); proxyIPAddressTextField.setForeground(Color.black); proxyIPAddressTextField.setBorder(BorderFactory.createLoweredBevelBorder()); firstPanel.add(proxyIPAddressLabel); firstPanel.add(proxyIPAddressTextField); outboundProxyLabel = new JLabel("Next hop (IP:port/protocol):"); outboundProxyLabel.setToolTipText( "Location where the message will be sent " + "if all the resolutions (DNS, router,...) fail. If not set: 404 will be replied"); // Alignment of the text outboundProxyLabel.setHorizontalAlignment(AbstractButton.CENTER); // Color of the text outboundProxyLabel.setForeground(Color.black); // Size of the text outboundProxyLabel.setFont(new Font("Dialog", 1, 12)); // If put to true: we see the label's background outboundProxyLabel.setOpaque(true); outboundProxyLabel.setBackground(ProxyLauncher.labelBackGroundColor); outboundProxyLabel.setBorder(ProxyLauncher.labelBorder); outboundProxyTextField = new JTextField(20); outboundProxyTextField.setHorizontalAlignment(AbstractButton.CENTER); outboundProxyTextField.setFont(new Font("Dialog", 0, 14)); outboundProxyTextField.setBackground(ProxyLauncher.textBackGroundColor); outboundProxyTextField.setForeground(Color.black); outboundProxyTextField.setBorder(BorderFactory.createLoweredBevelBorder()); firstPanel.add(outboundProxyLabel); firstPanel.add(outboundProxyTextField); routerClassLabel = new JLabel("The Router class name:"); routerClassLabel.setToolTipText( "The class name (full java package name) of the router" + " used to forward the messages"); // Alignment of the text routerClassLabel.setHorizontalAlignment(AbstractButton.CENTER); // Color of the text routerClassLabel.setForeground(Color.black); // Size of the text routerClassLabel.setFont(new Font("Dialog", 1, 12)); // If put to true: we see the label's background routerClassLabel.setOpaque(true); routerClassLabel.setBackground(ProxyLauncher.labelBackGroundColor); routerClassLabel.setBorder(ProxyLauncher.labelBorder); routerClassTextField = new JTextField(20); routerClassTextField.setHorizontalAlignment(AbstractButton.CENTER); routerClassTextField.setFont(new Font("Dialog", 0, 12)); routerClassTextField.setBackground(ProxyLauncher.textBackGroundColor); routerClassTextField.setForeground(Color.black); routerClassTextField.setBorder(BorderFactory.createLoweredBevelBorder()); firstPanel.add(routerClassLabel); firstPanel.add(routerClassTextField); JPanel panel = new JPanel(); // top, left, bottom, right panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 2)); // If put to False: we see the container's background panel.setOpaque(false); // rows, columns, horizontalGap, verticalGap panel.setLayout(new BorderLayout()); this.add(panel); JLabel lpLabel = new JLabel("Listening points list:"); lpLabel.setVisible(true); lpLabel.setToolTipText("The listening points of the proxy"); lpLabel.setHorizontalAlignment(AbstractButton.CENTER); lpLabel.setForeground(Color.black); lpLabel.setFont(new Font("Dialog", 1, 12)); lpLabel.setOpaque(true); lpLabel.setBackground(ProxyLauncher.labelBackGroundColor); lpLabel.setBorder(ProxyLauncher.labelBorder); panel.add(lpLabel, BorderLayout.NORTH); // this.add(listeningPointsList); JScrollPane scrollPane = new JScrollPane( listeningPointsList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); panel.add(scrollPane, BorderLayout.CENTER); thirdPanel = new JPanel(); thirdPanel.setOpaque(false); // top, left, bottom, right thirdPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 5, 0)); thirdPanel.setLayout(new GridLayout(1, 2, 3, 3)); JButton addLPButton = new JButton(" Add "); addLPButton.setToolTipText("Add a listening point"); addLPButton.setFocusPainted(false); addLPButton.setFont(new Font("Dialog", 1, 16)); addLPButton.setBackground(ProxyLauncher.buttonBackGroundColor); addLPButton.setBorder(ProxyLauncher.buttonBorder); addLPButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { addLPButtonActionPerformed(evt); } }); thirdPanel.add(addLPButton); JButton removeLPButton = new JButton(" Remove "); removeLPButton.setToolTipText("Remove a listening point"); removeLPButton.setFocusPainted(false); removeLPButton.setFont(new Font("Dialog", 1, 16)); removeLPButton.setBackground(ProxyLauncher.buttonBackGroundColor); removeLPButton.setBorder(ProxyLauncher.buttonBorder); removeLPButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { removeLPButtonActionPerformed(evt); } }); thirdPanel.add(removeLPButton); panel.add(thirdPanel, BorderLayout.SOUTH); }
public void doInit() { final InviteResponseMessageBox _this = this; if (!this.message.isDealtWith()) { // Show the response. this.responseBox = new Box(BoxLayout.Y_AXIS); this.add(this.responseBox); JComponent l = UIUtils.createBoldSubHeader( String.format( "%s the invitation", (this.message.isAccepted() ? "Accepted" : "Rejected")), (this.message.isAccepted() ? Constants.ACCEPTED_ICON_NAME : Constants.REJECTED_ICON_NAME)); this.responseBox.add(l); this.responseBox.setBorder(UIUtils.createPadding(5, 5, 0, 5)); if (this.message.isAccepted()) { if ((this.message.getEditorName() != null) || (this.message.getEditorAvatar() != null)) { JTextPane desc = UIUtils.createHelpTextPane( "Additionally they provided the following name/avatar.", this.projectViewer); this.responseBox.add(Box.createVerticalStrut(5)); this.responseBox.add(desc); desc.setBorder(null); desc.setSize(new Dimension(UIUtils.getPopupWidth() - 20, desc.getPreferredSize().height)); Box editorInfo = new Box(BoxLayout.X_AXIS); editorInfo.setAlignmentX(Component.LEFT_ALIGNMENT); editorInfo.setBorder(UIUtils.createPadding(5, 5, 5, 5)); this.responseBox.add(editorInfo); if (this.message.getEditorAvatar() != null) { JLabel avatar = new JLabel(); avatar.setAlignmentY(Component.TOP_ALIGNMENT); avatar.setVerticalAlignment(SwingConstants.TOP); editorInfo.add(avatar); avatar.setOpaque(false); avatar.setIcon( new ImageIcon(UIUtils.getScaledImage(_this.message.getEditorAvatar(), 50))); avatar.setBorder( new CompoundBorder(UIUtils.createPadding(0, 0, 0, 5), UIUtils.createLineBorder())); } if (this.message.getEditorName() != null) { JLabel name = new JLabel(this.message.getEditorName()); editorInfo.add(name); name.setBorder(null); name.setAlignmentY(Component.TOP_ALIGNMENT); name.setVerticalAlignment(JLabel.TOP); name.setAlignmentX(Component.LEFT_ALIGNMENT); name.setFont( name.getFont() .deriveFont((float) UIUtils.getScaledFontSize(14)) .deriveFont(java.awt.Font.PLAIN)); } } } final EditorEditor ed = this.message.getEditor(); JButton ok = new JButton("Ok, got it"); ok.addActionListener( new ActionAdapter() { public void actionPerformed(ActionEvent ev) { try { if (_this.message.isAccepted()) { ed.setEditorStatus(EditorEditor.EditorStatus.current); if (_this.message.getEditorName() != null) { ed.setName(_this.message.getEditorName()); } if (_this.message.getEditorAvatar() != null) { ed.setAvatar(_this.message.getEditorAvatar()); } EditorsEnvironment.updateEditor(ed); // Is this response for an invite message or just out of the blue from a web // service invite? if (!EditorsEnvironment.hasSentMessageOfTypeToEditor( ed, InviteMessage.MESSAGE_TYPE)) { EditorsEnvironment.sendUserInformationToEditor(ed, null, null, null); } } else { ed.setEditorStatus(EditorEditor.EditorStatus.rejected); EditorsEnvironment.updateEditor(ed); } _this.message.setDealtWith(true); EditorsEnvironment.updateMessage(_this.message); _this.responseBox.setVisible(false); } catch (Exception e) { Environment.logError("Unable to update editor: " + ed, e); UIUtils.showErrorMessage( _this.projectViewer, "Unable to update {editor}, please contact Quoll Writer support for assitance."); return; } } }); JButton[] buts = new JButton[] {ok}; JPanel bb = UIUtils.createButtonBar2(buts, Component.LEFT_ALIGNMENT); bb.setOpaque(false); bb.setAlignmentX(Component.LEFT_ALIGNMENT); bb.setBorder(UIUtils.createPadding(5, 0, 0, 0)); this.responseBox.add(bb); return; } boolean accepted = this.message.isAccepted(); String iconName = (accepted ? Constants.ACCEPTED_ICON_NAME : Constants.REJECTED_ICON_NAME); String message = "Accepted invitation to be {an editor}"; if (!accepted) { message = "Rejected invitation to be {an editor}"; } JComponent h = UIUtils.createBoldSubHeader(message, iconName); this.add(h); }
/** This method is called from within the constructor to initialize the form. */ public void initComponents() { /** *************** The main frame ************************************** */ // width, height this.setSize(560, 370); Container container = this.getContentPane(); container.setLayout(new BoxLayout(getContentPane(), 1)); container.setBackground(containerBackGroundColor); this.setLocation(0, 0); this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { new AlertInstantMessaging( "Your changes will not be checked: use the Submit button!!!", JOptionPane.WARNING_MESSAGE); hideFrame(); } }); /** **************** The components ********************************* */ firstPanel = new JPanel(); firstPanel.setBorder(BorderFactory.createEmptyBorder(15, 4, 15, 4)); // If put to False: we see the container's background firstPanel.setOpaque(false); // rows, columns, horizontalGap, verticalGap firstPanel.setLayout(new GridLayout(11, 2, 2, 2)); container.add(firstPanel); outboundProxyAddressLabel = new JLabel("Outbound proxy IP address:"); outboundProxyAddressLabel.setForeground(Color.black); outboundProxyAddressTextField = new JTextField(20); outboundProxyAddressLabel.setBorder(labelBorder); outboundProxyAddressLabel.setOpaque(true); outboundProxyAddressLabel.setBackground(labelBackGroundColor); firstPanel.add(outboundProxyAddressLabel); firstPanel.add(outboundProxyAddressTextField); outboundProxyPortLabel = new JLabel("Outbound proxy port:"); outboundProxyPortLabel.setForeground(Color.black); outboundProxyPortTextField = new JTextField(20); outboundProxyPortLabel.setBorder(labelBorder); outboundProxyPortLabel.setOpaque(true); outboundProxyPortLabel.setBackground(labelBackGroundColor); firstPanel.add(outboundProxyPortLabel); firstPanel.add(outboundProxyPortTextField); registrarAddressLabel = new JLabel("Registrar IP address:"); registrarAddressLabel.setForeground(Color.black); registrarAddressTextField = new JTextField(20); registrarAddressLabel.setBorder(labelBorder); registrarAddressLabel.setOpaque(true); registrarAddressLabel.setBackground(labelBackGroundColor); firstPanel.add(registrarAddressLabel); firstPanel.add(registrarAddressTextField); registrarPortLabel = new JLabel("Registrar port:"); registrarPortLabel.setForeground(Color.black); registrarPortTextField = new JTextField(20); registrarPortLabel.setBorder(labelBorder); registrarPortLabel.setOpaque(true); registrarPortLabel.setBackground(labelBackGroundColor); firstPanel.add(registrarPortLabel); firstPanel.add(registrarPortTextField); imAddressLabel = new JLabel("Contact IP address:"); imAddressLabel.setForeground(Color.black); imAddressTextField = new JTextField(20); imAddressLabel.setBorder(labelBorder); imAddressLabel.setOpaque(true); imAddressLabel.setBackground(labelBackGroundColor); firstPanel.add(imAddressLabel); firstPanel.add(imAddressTextField); imPortLabel = new JLabel("Contact port:"); imPortLabel.setForeground(Color.black); imPortTextField = new JTextField(20); imPortLabel.setBorder(labelBorder); imPortLabel.setOpaque(true); imPortLabel.setBackground(labelBackGroundColor); firstPanel.add(imPortLabel); firstPanel.add(imPortTextField); imProtocolLabel = new JLabel("Contact transport:"); imProtocolLabel.setForeground(Color.black); imProtocolTextField = new JTextField(20); imProtocolLabel.setBorder(labelBorder); imProtocolLabel.setOpaque(true); imProtocolLabel.setBackground(labelBackGroundColor); firstPanel.add(imProtocolLabel); firstPanel.add(imProtocolTextField); outputFileLabel = new JLabel("Output file:"); outputFileLabel.setForeground(Color.black); outputFileTextField = new JTextField(20); outputFileLabel.setBorder(labelBorder); outputFileLabel.setOpaque(true); outputFileLabel.setBackground(labelBackGroundColor); firstPanel.add(outputFileLabel); firstPanel.add(outputFileTextField); buddiesFileLabel = new JLabel("Buddies file:"); buddiesFileLabel.setForeground(Color.black); buddiesFileTextField = new JTextField(20); buddiesFileLabel.setBorder(labelBorder); buddiesFileLabel.setOpaque(true); buddiesFileLabel.setBackground(labelBackGroundColor); firstPanel.add(buddiesFileLabel); firstPanel.add(buddiesFileTextField); authenticationFileLabel = new JLabel("Authentication file:"); authenticationFileLabel.setForeground(Color.black); authenticationFileTextField = new JTextField(20); authenticationFileLabel.setBorder(labelBorder); authenticationFileLabel.setOpaque(true); authenticationFileLabel.setBackground(labelBackGroundColor); firstPanel.add(authenticationFileLabel); firstPanel.add(authenticationFileTextField); defaultRouterLabel = new JLabel("Default router class name:"); defaultRouterLabel.setForeground(Color.black); defaultRouterTextField = new JTextField(20); defaultRouterLabel.setBorder(labelBorder); defaultRouterLabel.setOpaque(true); defaultRouterLabel.setBackground(labelBackGroundColor); firstPanel.add(defaultRouterLabel); firstPanel.add(defaultRouterTextField); thirdPanel = new JPanel(); thirdPanel.setOpaque(false); // top, left, bottom, right thirdPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); submitButton = new JButton(" Submit "); submitButton.setToolTipText("Submit your changes!"); submitButton.setFocusPainted(false); submitButton.setFont(new Font("Dialog", 1, 16)); submitButton.setBackground(buttonBackGroundColor); submitButton.setBorder(buttonBorder); submitButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { submitButtonActionPerformed(evt); } }); thirdPanel.add(submitButton); container.add(thirdPanel); }
@SuppressWarnings("serial") private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(null); this.setTitle("Overzicht"); this.setVisible(true); { lStart = new JLabel(); getContentPane().add(lStart); lStart.setText("Overzicht"); lStart.setHorizontalAlignment(SwingConstants.CENTER); lStart.setBackground(new java.awt.Color(54, 190, 54)); lStart.setFont(new java.awt.Font("Arial", 1, 36)); lStart.setForeground(new java.awt.Color(0, 128, 64)); lStart.setOpaque(true); lStart.setBounds(0, 0, 336, 49); } { pInzet = new JPanel(); getContentPane().add(pInzet); pInzet.setBorder( BorderFactory.createTitledBorder( null, "Selectie", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); pInzet.setLayout(null); pInzet.setBounds(14, 63, 308, 105); pInzet.setFont(new java.awt.Font("Tahoma", 1, 12)); { lMin = new JLabel(); pInzet.add(lMin); lMin.setText("Speler"); lMin.setFont(new java.awt.Font("Arial", 0, 12)); lMin.setBounds(17, 59, 62, 27); } { lMax = new JLabel(); pInzet.add(lMax); lMax.setText("Spelronde"); lMax.setFont(new java.awt.Font("Arial", 0, 12)); lMax.setBounds(17, 26, 62, 25); } // Combo voor Spelrondes. Deze wordt eerst geladen. Na selectie // wordt de speler gevuld. { oc = new OverzichtController(this); String[] rondes = oc.GeefSpelrondes(); ComboBoxModel cbSpelRondeModel = new DefaultComboBoxModel(rondes); cbSpelRonde = new JComboBox(); pInzet.add(cbSpelRonde); cbSpelRonde.setModel(cbSpelRondeModel); cbSpelRonde.setBounds(91, 29, 156, 21); cbSpelRonde.setToolTipText("Maak een keuze uit de gespeelde speelronden."); } { bStart = new JButton(); getContentPane().add(bStart); bStart.setText("Sluiten"); bStart.setFont(new java.awt.Font("Arial", 0, 12)); bStart.setBounds(196, 303, 75, 23); bStart.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { bStartActionPerformed(evt); } }); } } pack(); this.setSize(352, 364); } catch (Exception e) { e.printStackTrace(); } } // private void initGUI()