public ConditionEditor() { super(); btn = new JButton(){ { setUI(BasicButtonUI.createUI(this)); } @Override public Color getBackground() { return getSelectionBackground(); } }; }
/** * @param name * @param defaultColor */ public ColorProperty(final String name, final String defaultColor) { super(name); this.defaultColor = defaultColor; mButton = new JButton() { /** * */ private static final long serialVersionUID = 1L; { setBorder(BorderFactory.createEtchedBorder()); setUI(BasicButtonUI.createUI(this)); } }; mButton.addActionListener(this); color = Color.BLACK; }
public Component create(Context context) { JButton button = new ToolWindowActiveButton(); button.setUI((ButtonUI) BasicButtonUI.createUI(button)); return button; }
@Override public void updateUI() { setMargin(new Insets(0, 0, 0, 0)); super.updateUI(); final Insets insets = getInsets(); if(insets.left + insets.right > 8){ setUI(BasicButtonUI.createUI(this)); setBorder(BorderFactory.createLineBorder(Color.GRAY)); } }
public LabToolbarButton( String text, Icon icon, int iMarginW, int iMarginH ) { super( text, icon ); setUI( BasicButtonUI.createUI( this ) ); setBorderPainted( false ); setMargin( new Insets( 1, 1, 1, 1 ) ); setBackground( Scheme.active().getControl() ); setContentAreaFilled( false ); setOpaque( true ); EventQueue.invokeLater( () -> { setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder( Scheme.active().getXpBorderColor() ), BorderFactory.createEmptyBorder( iMarginH, iMarginW, iMarginH, iMarginW ) ) ); } ); _bShowText = false; addMouseListener( createMouseListener() ); }
startStopButton.setUI((ButtonUI) BasicButtonUI.createUI(startStopButton)); startStopButton.setIcon(new ImageIcon(imgs[0])); startStopButton.setDisabledIcon(new ImageIcon(imgs[1])); img = Images.createImage(ScreenRecorderCompactMain.class, "images/Recorder.Options.png"); imgs = Images.split(img, 2, true); optionsButton.setUI((ButtonUI) BasicButtonUI.createUI(startStopButton)); optionsButton.setIcon(new ImageIcon(imgs[0])); optionsButton.setDisabledIcon(new ImageIcon(imgs[1]));
startStopButton.setUI((ButtonUI) BasicButtonUI.createUI(startStopButton)); startStopButton.setIcon(new ImageIcon(imgs[0])); startStopButton.setDisabledIcon(new ImageIcon(imgs[1])); img = Images.createImage(ScreenRecorderCompactMain.class, "images/Recorder.Options.png"); imgs = Images.split(img, 2, true); optionsButton.setUI((ButtonUI) BasicButtonUI.createUI(startStopButton)); optionsButton.setIcon(new ImageIcon(imgs[0])); optionsButton.setDisabledIcon(new ImageIcon(imgs[1]));
/** * Initializes this item. */ private void init() { this.setUI(BasicButtonUI.createUI(this)); setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 20)); setMenuItemDefaultColors(); this.setAlignmentX(JButton.LEFT_ALIGNMENT); setSelected(false); this.addMouseListener (new MouseAdapter() { public void mouseEntered(MouseEvent e) { if (DefaultScrollablePopupMenuItem.this.isEnabled()) { setSelected(true); parent.selectionChanged (DefaultScrollablePopupMenuItem.this, true); } } public void mouseExited(MouseEvent e) { if (DefaultScrollablePopupMenuItem.this.isEnabled()) { setSelected(false); parent.selectionChanged (DefaultScrollablePopupMenuItem.this, false); } } public void mouseClicked(MouseEvent e) { parent.processItemClicked(); } }); }
private JButton addStyleButton(DefaultFormBuilder formBuilder, String label, AFreeplaneAction action) { final JButton button = new JButton(){ private static final long serialVersionUID = 1L; { setUI(BasicButtonUI.createUI(this)); } }; button.addActionListener(action); button.setHorizontalAlignment(SwingConstants.LEFT); final String labelText = TextUtils.getText(label); UITools.addTitledBorder(button, labelText, StyleEditorPanel.FONT_SIZE); TranslatedElement.BORDER.setKey(button, label); formBuilder.append(button, formBuilder.getColumnCount()); formBuilder.nextLine(); return button; }
/** * Initializes this item. */ private void init() { this.setUI(BasicButtonUI.createUI(this)); setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 20)); setMenuItemDefaultColors(); this.setAlignmentX(JButton.LEFT_ALIGNMENT); setSelected(false); this.addMouseListener (new MouseAdapter() { public void mouseEntered(MouseEvent e) { if (DefaultScrollablePopupMenuItem.this.isEnabled()) { setSelected(true); parent.selectionChanged (DefaultScrollablePopupMenuItem.this, true); } } public void mouseExited(MouseEvent e) { if (DefaultScrollablePopupMenuItem.this.isEnabled()) { setSelected(false); parent.selectionChanged (DefaultScrollablePopupMenuItem.this, false); } } public void mouseClicked(MouseEvent e) { parent.processItemClicked(); } }); }
/** * Creates a button with an icon. * * @param icon The icon that should be display for this button. */ public XPToolbarButton( String text, Icon icon, int iMargin ) { super( text, icon ); setUI( BasicButtonUI.createUI( this ) ); setBorderPainted( false ); setMargin( new Insets( 1, 1, 1, 1 ) ); setBackground(EditorUtilities.CONTROL ); setContentAreaFilled( false ); setOpaque( true ); EventQueue.invokeLater( new Runnable() { public void run() { setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder( EditorUtilities.XP_BORDER_COLOR ), BorderFactory.createEmptyBorder( iMargin, iMargin, iMargin, iMargin ) ) ); setBackground(EditorUtilities.CONTROL ); } } ); addMouseListener( createMouseListener() ); setToolTipText( "" ); // fake out Swing into registering us with the tooltip manager }