protected void addStyleButtons() { borderBtn = new JButton(STLConstants.K0530_SHOW_BORDER.getValue(), UIImages.HIDE_BORDER.getImageIcon()); borderBtn.setOpaque(false); borderBtn.setFocusable(false); borderBtn.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isSelected = borderBtn.getIcon() != UIImages.SHOW_BORDER.getImageIcon(); setShowBorder(isSelected); if (listener != null) { listener.onShowBorder(isSelected); } } }); toolBar.add(borderBtn); alternationBtn = new JButton(STLConstants.K0533_UNI_ROWS.getValue(), UIImages.UNI_ROWS.getImageIcon()); alternationBtn.setOpaque(false); alternationBtn.setFocusable(false); alternationBtn.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isSelected = alternationBtn.getIcon() != UIImages.ALT_ROWS.getImageIcon(); setShowAlternation(isSelected); if (listener != null) { listener.onShowAlternation(isSelected); } } }); toolBar.add(alternationBtn); }
/** * Initializes the components. * * @param nameSpace The name space to use to determine the name. * @param index The value of the results. */ private void initComponents(String nameSpace, int index) { attachments = new ArrayList<FileAnnotationData>(); this.nameSpace = nameSpace; resultsButton = new JButton(); resultsButton.setText(convertNameSpace(nameSpace) + " #" + index); resultsButton.setOpaque(false); resultsButton.setForeground(UIUtilities.HYPERLINK_COLOR); resultsButton.setBackground(UIUtilities.BACKGROUND_COLOR); UIUtilities.unifiedButtonLookAndFeel(resultsButton); resultsButton.setActionCommand("" + VIEW); resultsButton.addActionListener(this); cancelButton = new JButton(); cancelButton.setText("Cancel"); cancelButton.setToolTipText("Cancel results loading."); cancelButton.setOpaque(false); cancelButton.setForeground(UIUtilities.HYPERLINK_COLOR); cancelButton.setBackground(UIUtilities.BACKGROUND_COLOR); UIUtilities.unifiedButtonLookAndFeel(cancelButton); cancelButton.setActionCommand("" + CANCEL); cancelButton.addActionListener(this); IconManager icons = IconManager.getInstance(); deleteButton = new JMenuItem(icons.getIcon(IconManager.DELETE_12)); deleteButton.setText("Delete"); deleteButton.setToolTipText("Delete the results."); deleteButton.setActionCommand("" + DELETE); deleteButton.addActionListener(this); downloadButton = new JMenuItem(icons.getIcon(IconManager.DOWNLOAD_12)); downloadButton.setText("Download..."); downloadButton.setToolTipText("Download the selected file."); downloadButton.setActionCommand("" + DOWNLOAD); downloadButton.addActionListener(this); menuButton = new JButton(icons.getIcon(IconManager.UP_DOWN_9_12)); UIUtilities.unifiedButtonLookAndFeel(menuButton); menuButton.setBackground(UIUtilities.BACKGROUND_COLOR); menuButton.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { Point p = e.getPoint(); showMenu(menuButton, p); } }); infoButton = new JMenuItem(icons.getIcon(IconManager.INFO)); infoButton.setText("Info..."); infoButton.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { Point p = e.getPoint(); displayInformation(p); } }); setBackground(UIUtilities.BACKGROUND_COLOR); }
/** Creates the layout of the panel (but the contents are not populated here). */ protected void createLayout() { JPanel p = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); p.setOpaque(false); p.setBorder(PANEL_BORDER); createBasicLayout(p, gbc); gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 0; JScrollPane scroll = Utilities.createBorderLessScrollBar(p); scrollListener = ScrollPaneBorderListener.createBottomBorderListener(scroll); add(scroll, gbc); gbc.gridy++; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(10, 10, 10, 10); gbc.gridwidth = 1; delete = Utilities.createButton(INFO_CTRL_PANEL_DELETE_OBJECTCLASS_BUTTON.get()); delete.setOpaque(false); add(delete, gbc); delete.addActionListener( new ActionListener() { /** {@inheritDoc} */ @Override public void actionPerformed(ActionEvent ev) { deleteObjectclass(); } }); gbc.anchor = GridBagConstraints.EAST; gbc.gridx++; saveChanges = Utilities.createButton(INFO_CTRL_PANEL_SAVE_CHANGES_LABEL.get()); saveChanges.setOpaque(false); add(saveChanges, gbc); saveChanges.addActionListener( new ActionListener() { /** {@inheritDoc} */ @Override public void actionPerformed(ActionEvent ev) { ArrayList<LocalizableMessage> errors = new ArrayList<>(); saveChanges(false, errors); } }); }
/** Method to create link annotation GUI. */ private void createGUI() { // Create and setup an Appearance panel setBorder( new TitledBorder( new EtchedBorder(EtchedBorder.LOWERED), messageBundle.getString("viewer.utilityPane.annotation.ink.appearance.title"), TitledBorder.LEFT, TitledBorder.DEFAULT_POSITION)); // Line thickness lineThicknessBox = new JComboBox(LINE_THICKNESS_LIST); lineThicknessBox.setSelectedIndex(DEFAULT_LINE_THICKNESS); lineThicknessBox.addItemListener(this); add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.lineThickness"))); add(lineThicknessBox); // Line style lineStyleBox = new JComboBox(LINE_STYLE_LIST); lineStyleBox.setSelectedIndex(DEFAULT_LINE_STYLE); lineStyleBox.addItemListener(this); add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.lineStyle"))); add(lineStyleBox); // border colour colorBorderButton = new JButton(); colorBorderButton.addActionListener(this); colorBorderButton.setOpaque(true); colorBorderButton.setBackground(DEFAULT_BORDER_COLOR); add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.colorBorderLabel"))); add(colorBorderButton); }
private void addHeaderComponents() { this.title = new JLabel("Gregg Shorthand Recognizer"); this.title.setBounds(250, 50, 300, 30); this.title.setFont(new Font("Sans Serif", Font.BOLD, 20)); this.add(title); this.heading = new JLabel("Train and Test"); this.heading.setBounds(120, 105, 200, 30); this.heading.setFont(new Font("Sans Serif", Font.BOLD, 16)); this.heading.setForeground(Color.WHITE); this.add(heading); backButton = new JButton(); backButton.setBounds(50, 97, 45, 45); this.add(backButton); backButton.setFocusPainted(false); backButton.setBorderPainted(false); backButton.setContentAreaFilled(false); backButton.setOpaque(false); backButton.addActionListener(this); Image img; try { img = ImageIO.read(new File("images/ui/button.png")); backButton.setIcon(new ImageIcon(img)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } navBar = new JPanel(); navBar.setBounds(0, 100, 800, 40); navBar.setBackground(new Color(0, 174, 239)); this.add(navBar); }
public ProgressDialog(Frame owner, String title) { super(owner, title); openProgressButton.setToolTipText("Console"); openProgressButton.setBackground(Color.WHITE); openProgressButton.setForeground(Color.WHITE); openProgressButton.setIcon( new ImageIcon(DBSGeneralPanel.class.getResource("/img/console.png"))); openProgressButton.setOpaque(false); openProgressButton.setContentAreaFilled(false); openProgressButton.setBorderPainted(false); openProgressButton.setFocusPainted(false); openProgressButton.setVisible( false); // By default set as invisible until collection is executed. progressTextArea.setEditable(false); // this.setLocationRelativeTo(openProgressButton); this.setModalityType(Dialog.ModalityType.valueOf("APPLICATION_MODAL")); this.add(progressScrollPane); this.setSize(1200, 400); openProgressButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { ProgressDialog.this.setLocationRelativeTo(ProgressDialog.this.openProgressButton); ProgressDialog.this.setVisible(true); } }); }
private void newComps() { ta = new JTextArea(); // ta.setLineWrap(true); ta.setWrapStyleWord(true); ta.setFocusable(false); ta.setEditable(false); ta.setFont(new Font("Courier New", Font.BOLD, 20)); ta.setBackground(Color.black); ta.setForeground(Color.GREEN); sc = new JScrollPane(); sc.setViewportView(ta); btnExport = new JButton("Export"); btnExport.setOpaque(false); btnExport.setFont(ta.getFont()); btnExport.setFocusable(false); ckWrap = new JCheckBox("Wrap text"); ckWrap.setOpaque(false); ckWrap.setForeground(Color.white); ckWrap.setFont(ta.getFont()); ckWrap.setFocusable(false); chooser = new JFileChooser(); }
public ButtonEditor(JCheckBox checkBox, Main main) { super(checkBox); button = new JButton(); button.setOpaque(true); this.main = main; }
/** * Creates a JButton with an X * * @return the button */ private JButton createXButton() { JButton closeButton = new JButton("X"); closeButton.setOpaque(false); closeButton.setMargin(null); closeButton.setFont(closeButton.getFont().deriveFont(Font.BOLD).deriveFont((float) 10)); closeButton.setBorder(new EmptyBorder(1, 1, 1, 1)); return closeButton; }
/* */ private JButton createTitleButton() /* */ { /* 487 */ JButton localJButton = new JButton(); /* */ /* 489 */ localJButton.setFocusPainted(false); /* 490 */ localJButton.setFocusable(false); /* 491 */ localJButton.setOpaque(true); /* 492 */ return localJButton; /* */ }
@Override public void installUI(JComponent component) { super.installUI(component); JButton button = (JButton) component; button.setSize(new Dimension(17, 16)); button.setOpaque(false); button.setBorderPainted(false); }
public void setButton(JButton jbtn) { jbtn.setOpaque(false); jbtn.setMargin(new Insets(0, 0, 0, 0)); jbtn.setContentAreaFilled(false); jbtn.setFocusPainted(false); jbtn.setBorderPainted(false); jbtn.setBorder(null); jbtn.addMouseListener(new ButtonListener()); }
public void addToToolbar(Action action, Activator activator) { JButton button = toolbar.add(makeToolbarAction(action)); button.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 5)); button.setOpaque(false); button.setMargin(new Insets(1, 1, 1, 1)); if (activator != null) { registerComponent(button, activator); } }
private void setupButton(JButton button) { button.setOpaque(false); button.setContentAreaFilled(false); button.setBorderPainted(false); button.setForeground(Color.white); button.setHorizontalTextPosition(JButton.CENTER); button.setVerticalTextPosition(JButton.TOP); button.setFont(new Font("Sans Serif", Font.PLAIN, 12)); }
/** Initializes the UI components. */ private void initComponents() { setBorder(null); setLayout(new BorderLayout()); JPanel p = new JPanel(); p.setBorder(new EmptyBorder(5, 5, 5, 5)); p.setLayout(new BorderLayout(5, 5)); p.setBackground(Color.white); playButton = new JButton(DataViewer.getIcon("icons/audio_play.gif")); playButton.setOpaque(false); playButton.setBorder(null); playButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { togglePlay(); } }); p.add(playButton, BorderLayout.WEST); // popup menu for URL text field JPopupMenu popupMenu = new JPopupMenu(); final JMenuItem pasteMenuItem = new JMenuItem("Paste"); pasteMenuItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { TransferHandler.getPasteAction() .actionPerformed( new ActionEvent( streamURLField, ae.getID(), ae.getActionCommand(), ae.getWhen(), ae.getModifiers())); } }); popupMenu.add(pasteMenuItem); streamURLField = new JTextField(); streamURLField.setBorder(null); streamURLField.setComponentPopupMenu(popupMenu); streamURLField.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { updateURL(); } }); p.add(streamURLField, BorderLayout.CENTER); titleLabel = new JLabel("Audio Player", DataViewer.getIcon("icons/audio.gif"), SwingConstants.LEADING); SimpleInternalFrame sif = new SimpleInternalFrame(titleLabel, null, p); add(sif, BorderLayout.CENTER); }
/* * We do custom rendering of the arrow button because there are too many * hacks in each theme's combobox UI. * We also cannot forward paint of the arrow button to a stock combobox * because each LAF and theme may render different parts of the * arrow button with different sizes. For example, in Mac, the arrow button is * drawn with a border (the responsibility of the border * near the arrow button belongs to the button). However in IntelliJ and Darcula, * the arrow button is drawn without a border and it's the responsibility of the * outer control to draw a border. In addition, darcula renders part of the arrow * button outside the button. That is, the arrow button looks like it's about 20x20, * but actually, it's only 16x16, with part of the rendering done via paint on the combobox itself. * So while this creates some small inconsistencies, * it reduces the chance of a major UI issue such as a completely poorly drawn button with a double border. */ private JButton createArrowButton() { final Color bg = getBackground(); final Color fg = getForeground(); JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) { @Override public void paint(Graphics g2) { final Graphics2D g = (Graphics2D) g2; final GraphicsConfig config = new GraphicsConfig(g); final int w = getWidth(); final int h = getHeight(); g.setColor(getButtonBackgroundColor()); g.fillRect(0, 0, w, h); g.setColor(getArrowColor()); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); g.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); final int midx = (int) Math.ceil((w - 1) / 2.0) + 1; final int midy = (int) Math.ceil(h / 2.0); final Path2D.Double path = new Path2D.Double(); path.moveTo(midx - 4, midy - 2); path.lineTo(midx + 4, midy - 2); path.lineTo(midx, midy + 4); path.lineTo(midx - 4, midy - 2); path.closePath(); g.fill(path); g.setColor(getBorderColor()); if (UIUtil.isUnderGTKLookAndFeel()) { g.drawLine(0, 1, 0, h - 2); g.drawLine(0, 1, w - 2, 1); g.drawLine(0, h - 2, w - 2, h - 2); g.drawLine(w - 2, 1, w - 2, h - 2); } else { g.drawLine(0, 0, 0, h); } config.restore(); } @Override public Dimension getPreferredSize() { int newSize = CustomizableComboBox.this.getHeight() - (CustomizableComboBox.this.getInsets().bottom + CustomizableComboBox.this.getInsets().top); return new Dimension(newSize, newSize); } }; button.setOpaque(false); button.setFocusable(false); button.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 1)); return button; }
public void setAdditionalProperties() { btLogin.setBorder(null); btLogin.setOpaque(false); btLogin.setContentAreaFilled(false); btLogin.setBorderPainted(false); btLogin.setCursor(new Cursor(Cursor.HAND_CURSOR)); btLogin.setVerticalTextPosition(SwingConstants.BOTTOM); btLogin.setHorizontalTextPosition(SwingConstants.CENTER); btLogin.setPressedIcon(new ImageIcon("files/pix/login.png")); }
/** * Creates the view class * * @param controller The controller of the view class */ public SelectMazeView(SelectMazeController controller) { this.controller = controller; this.mazelist = this.controller.getMazelist(); this.setPreferredSize(new Dimension(500, 500)); this.setLayout(new BorderLayout()); this.setBackground(Color.WHITE); this.setOpaque(true); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.selectMazeLabel = new JLabel("Select a maze"); this.selectMazeLabel.setFont(new Font("Sans Serif", Font.PLAIN, 20)); this.selectMazeLabel.setForeground(Color.BLACK); this.selectMazeLabel.setOpaque(false); this.selectMazeLabel.setPreferredSize(new Dimension(500, 70)); this.selectMazeLabel.setHorizontalAlignment(JLabel.CENTER); this.listpanel = new JPanel(); this.listpanel.setOpaque(false); this.listpanel.setLayout(new FlowLayout()); this.add(this.selectMazeLabel, BorderLayout.NORTH); this.add(this.listpanel, BorderLayout.CENTER); int i = 0; while (i < this.mazelist.size()) { String mazename = this.mazelist.get(i); JButton mazeButton = new JButton(mazename); mazeButton.addMouseListener(this.mazeButtonListener); mazeButton.setFont(new Font("Sans Serif", Font.PLAIN, 16)); mazeButton.setForeground(Color.DARK_GRAY); mazeButton.setOpaque(false); mazeButton.setContentAreaFilled(false); mazeButton.setBorderPainted(false); mazeButton.setOpaque(true); this.listpanel.add(mazeButton); i++; } }
/** * main method to fire up a JFrame on the screen * * @param args not used */ public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("Click me, huehuehue"); java.awt.Color myColor = new java.awt.Color(204, 255, 153); // R, G, B values. button.setBackground(myColor); button.setOpaque(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(button); frame.setSize(300, 300); frame.setVisible(true); }
public ButtonEditor(JCheckBox checkBox) { super(checkBox); button = new JButton(); button.setOpaque(true); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { fireEditingStopped(); } }); }
public Abschluss(String wahl, Sudoku s, Sudoku2 s2) { super("Sudoku-Abschluss"); this.setSize(270, 135); this.setLocation(250, 300); this.setLayout(null); this.setAlwaysOnTop(true); this.setResizable(false); this.setUndecorated(true); if (s == null) this.setLocationRelativeTo(s2); else this.setLocationRelativeTo(s); su = s; su2 = s2; w = wahl; ImageIcon icon = new ImageIcon("files/minigames/Sudoku/beispiel2.jpg"); icon.setImage(icon.getImage().getScaledInstance(290, 135, Image.SCALE_DEFAULT)); lab = new JLabel(icon); lab.setSize(270, 135); lab.setLocation(0, 0); this.add(lab); text = new JLabel(); text.setSize(250, 20); text.setLocation(10, 10); text.setForeground(Color.white); text.setHorizontalAlignment(0); lab.add(text); text2 = new JLabel(); text2.setSize(270, 20); text2.setLocation(10, 30); text2.setForeground(Color.white); lab.add(text2); ok = new JButton("OK"); ok.setSize(90, 30); ok.setLocation(80, 50); ok.setBorderPainted(false); ok.setBackground(Color.lightGray); ok.setForeground(Color.lightGray); ok.setOpaque(false); ok.setFont(new Font("Arial Black", 4, 20)); ok.setContentAreaFilled(false); ok.setFocusPainted(false); ok.addActionListener(this); ok.addMouseListener(this); lab.add(ok); textWahl(wahl); this.setVisible(true); }
/** * main method to fire up a JFrame on the screen * * @param args not used */ public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("click me and receive the most metal gift of all - DISSAPOINTMENT"); java.awt.Color myColor = new java.awt.Color(255, 200, 0); button.setBackground(myColor); button.setOpaque(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(button); frame.setSize(300, 300); frame.setVisible(true); }
/** * setupButton * * @return */ private JButton setupButton() { JButton btn = new JButton(); btn.setSize(25, 22); btn.setVisible(true); btn.setIcon(icon); btn.setDisabledIcon(iconDisabled); btn.setBorder(BorderFactory.createEmptyBorder()); btn.setOpaque(false); btn.setFocusPainted(false); return btn; }
/** * Create main panel with Manager panels on the left, result tabs on the right, and consoles in * the bottom. */ public PanelLeftRightBottom() { super(JSplitPane.VERTICAL_SPLIT, true); Preferences prefs = Preferences.userRoot().node(InjectionModel.class.getName()); int verticalSplitter = prefs.getInt(PanelLeftRightBottom.VERTICALSPLITTER_PREFNAME, 300); int horizontalSplitter = prefs.getInt(PanelLeftRightBottom.HORIZONTALSPLITTER_PREFNAME, 200); MediatorGUI.register(new AdapterLeftTabbedPane()); MediatorGUI.register(new AdapterRightTabbedPane()); // Tree and tabs on top this.leftRight = new JSplitPaneWithZeroSizeDivider(JSplitPane.HORIZONTAL_SPLIT, true); this.leftRight.setLeftComponent(MediatorGUI.left()); this.leftRight.setRightComponent(MediatorGUI.right()); this.leftRight.setDividerLocation(verticalSplitter); this.leftRight.setDividerSize(0); this.leftRight.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, HelperGUI.COMPONENT_BORDER)); this.setDividerSize(0); this.setBorder(null); JPanel leftRightBottomPanel = new JPanel(new BorderLayout()); leftRightBottomPanel.add(leftRight, BorderLayout.CENTER); ERSATZARROWPANEL.setLayout(new BorderLayout()); ERSATZARROWPANEL.setOpaque(false); ERSATZARROWPANEL.setPreferredSize(new Dimension(17, 22)); ERSATZARROWPANEL.setMaximumSize(new Dimension(17, 22)); JButton hideBottomButton = new BasicArrowButton(BasicArrowButton.NORTH); hideBottomButton.setBorderPainted(false); hideBottomButton.setOpaque(false); hideBottomButton.addActionListener(PanelLeftRightBottom.HIDESHOWPANEL); ERSATZARROWPANEL.add(Box.createHorizontalGlue()); ERSATZARROWPANEL.add(hideBottomButton, BorderLayout.EAST); ERSATZARROWPANEL.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, HelperGUI.COMPONENT_BORDER)); ERSATZARROWPANEL.setVisible(false); leftRightBottomPanel.add(ERSATZARROWPANEL, BorderLayout.SOUTH); // Setting for top and bottom components this.setTopComponent(leftRightBottomPanel); MediatorGUI.register(new PanelBottom()); this.setBottomComponent(MediatorGUI.bottomPanel()); this.setDividerLocation(594 - horizontalSplitter); // defines left and bottom pane this.setResizeWeight(1); }
@Override public void actionPerformed(ActionEvent e) { setResizable(false); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); add(contentPane); contentPane.setLayout(null); JLabel credits = new JLabel(); credits.setBounds(25, 25, 400, 170); credits.setText( "<html>VCellID for ImageJ<br/>Version 1.0<br/>by Alejandro Petit and Gisela de la Villa</html>"); credits.setVerticalAlignment(SwingConstants.CENTER); credits.setHorizontalAlignment(SwingConstants.CENTER); contentPane.add(credits); JLabel lblForMoreHelp = new JLabel("For more help on CellID options visit:"); lblForMoreHelp.setBounds(10, 193, 422, 14); contentPane.add(lblForMoreHelp); JButton button = new JButton("Link"); button.setBounds(50, 218, 350, 23); final URI uri; try { uri = new URI("http://ip138.qb.fcen.uba.ar/embnet/Cell-ID-Rcell/Cell-ID-main.htm"); button.setText("Cell-ID Online Help"); button.setHorizontalAlignment(SwingConstants.CENTER); button.setBorderPainted(false); button.setOpaque(false); button.setBackground(Color.lightGray); button.setForeground(Color.BLUE); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try { desktop.browse(uri); } catch (Exception ex) { } } else { } } }); contentPane.add(button); } catch (URISyntaxException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } setVisible(true); }
public ButtonEditorBase(JTextField checkBox, String image) { super(checkBox); this.setClickCountToStart(1); button = new EButton( image, new ActionListener() { public void actionPerformed(ActionEvent e) { fireEditingStopped(); } }); button.setOpaque(true); }
// 下箭头按钮 @Override protected JButton createArrowButton() { arrow = new JButton(""); // ImageIcon increase = new ImageIcon("img/DarkDownArrow.png"); // arrow.setIcon(increase); arrow.setRolloverEnabled(true); // arrow.setRolloverIcon(increase); arrow.setBorder(null); arrow.setBackground(SystemColor.inactiveCaptionBorder); arrow.setOpaque(false); arrow.setContentAreaFilled(false); return arrow; }
/** * Create the panel. * * @throws Exception */ private ExceptionPanel() { setLayout(new BorderLayout(0, 0)); panelMessage = new JPanel(); add(panelMessage, BorderLayout.NORTH); JButton btnEnlarge = new JButton("One or more exceptions occured. Click to show/hide."); btnEnlarge.setForeground(Color.RED); btnEnlarge.setOpaque(false); btnEnlarge.setContentAreaFilled(false); btnEnlarge.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { panelDetails.setVisible(!panelDetails.isVisible()); } }); panelMessage.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panelMessage.add(btnEnlarge); JButton btnClose = new JButton("x"); panelMessage.add(btnClose); btnClose.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { hideUs(); } }); panelDetails = new JPanel(); add(panelDetails, BorderLayout.CENTER); panelDetails.setLayout(new BorderLayout(0, 0)); textDetails = new JTextPane(); textDetails.setForeground(Color.RED); scrollPane = new JScrollPane( textDetails, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); panelDetails.add(scrollPane); this.addComponentListener( new ComponentAdapter() { public void componentResized(ComponentEvent e) { Dimension d = new Dimension(THIS.getWidth(), 200); scrollPane.setPreferredSize(d); } }); hideUs(); }
/** * Constructor. * * @param title the title of the tab component * @param editor the editor of the tab (used to close the tab) */ public TabComponent(final AbstractEditorPanel editor) { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); setOpaque(false); // title title = new JLabel(editor.getTitle()); title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); add(title, BorderLayout.WEST); // close final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png")); close.setPreferredSize(new Dimension(16, 16)); close.setUI(new BasicButtonUI()); close.setBorderPainted(false); close.setOpaque(false); close.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeEditor(editor, true); } }); close.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent me) {} @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) { close.setBorderPainted(true); } @Override public void mouseExited(MouseEvent me) { close.setBorderPainted(false); } }); add(close, BorderLayout.EAST); }
/** * main method to fire up a JFrame on the screen * * @param args not used */ public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("Pull my finger ༼ つ ◕_◕ ༽つ "); java.awt.Color myColor = new java.awt.Color(42, 200, 42); // R, G, B values. button.setBackground(myColor); button.setOpaque(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(button); frame.setSize(300, 300); frame.setVisible(true); }