Java Code Examples for javax.swing.JButton#setOpaque()

The following examples show how to use javax.swing.JButton#setOpaque() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusLineComponent.java    From netbeans with Apache License 2.0 8 votes vote down vote up
private void createCloseButton() {
    discardCloseButton();
    closeButton = new JButton();
    closeButton.setBorderPainted(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setOpaque(false);
    closeButton.setContentAreaFilled(false);
    
    Object img = UIManager.get("nb.progress.cancel.icon");
    if( null != img ) {
        closeButton.setIcon( ListComponent.iconOrImage2icon( img ) );
    }
    img = UIManager.get("nb.progress.cancel.icon.mouseover");
    if( null != img ) {
        closeButton.setRolloverEnabled(true);
        closeButton.setRolloverIcon( ListComponent.iconOrImage2icon( img ) );
    }
    img = UIManager.get("nb.progress.cancel.icon.pressed");
    if( null != img ) {
        closeButton.setPressedIcon( ListComponent.iconOrImage2icon( img ) );
    }
}
 
Example 2
Source File: MeasurementSetPanel.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
public JPanel getMarkerPairComponent(MarkerPair markerPair, int measurementIndex, int markerPairIndex) {
   JPanel panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
   panel.setBorder(markerPairControlsBorder);
   panel.setAlignmentX(0);

   // Markers
   panel.add(getMarkerComponent(markerPair.getMarkerName(0), measurementIndex, markerPairIndex, 0));
   panel.add(getMarkerComponent(markerPair.getMarkerName(1), measurementIndex, markerPairIndex, 1));

   // Delete marker pair button
   JButton removeMarkerPairButton = new JButton(new RemoveMarkerPairAction(measurementIndex, markerPairIndex));
   removeMarkerPairButton.setRolloverIcon(removeRolloverIcon);
   removeMarkerPairButton.setMargin(new Insets(0,0,0,0));
   removeMarkerPairButton.setMinimumSize(buttonDim);
   removeMarkerPairButton.setMaximumSize(buttonDim);
   removeMarkerPairButton.setPreferredSize(buttonDim);
   removeMarkerPairButton.setBorder(null);
   removeMarkerPairButton.setContentAreaFilled(false);
   removeMarkerPairButton.setOpaque(true);
   removeMarkerPairButton.setBackground(Color.white);
   panel.add(removeMarkerPairButton);

   return panel;
}
 
Example 3
Source File: WatchAnnotationProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addActions(JToolBar tb, Action[] actions) {
    tb.removeAll();
    boolean visible = false;
    if (actions != null) {
        for (Action a : actions) {
            if (a != null) {
                JButton btn = tb.add(a);
                btn.setBorder(new javax.swing.border.EmptyBorder(0, 2, 0, 2));
                btn.setBorderPainted(false);
                btn.setContentAreaFilled(false);
                btn.setRolloverEnabled(false);
                btn.setOpaque(false);
                btn.setFocusable(false);
                visible = true;
            } else {
                tb.add(new JSeparator(JSeparator.VERTICAL));
            }
        }
    }
    tb.setVisible(visible);
}
 
Example 4
Source File: SettlementTransparentPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void buildLabelPane() {

        labelPane = new JPanel(new FlowLayout(FlowLayout.LEADING));
        labelPane.setBackground(new Color(0,0,0,128));
		labelPane.setOpaque(false);

		JButton labelsButton = new JButton(Msg.getString("SettlementTransparentPanel.button.labels")); //$NON-NLS-1$
		//labelsButton.setFont(new Font("Dialog", Font.BOLD, 16));
		//labelsButton.setBackground(new Color(139,69,19)); // (139,69,19) is brown
		//labelsButton.setBackground(new Color(139,69,19,40));
		//labelsButton.setBackground(new Color(51,25,0,5)); // dull gold color
//		labelsButton.setBackground(new Color(0,0,0));//,0));
		labelsButton.setPreferredSize(new Dimension(80, 20));
//		labelsButton.setForeground(Color.green);
		labelsButton.setOpaque(false);
		labelsButton.setVerticalAlignment(JLabel.CENTER);
		labelsButton.setHorizontalAlignment(JLabel.CENTER);
		//labelsButton.setContentAreaFilled(false); more artifact when enabled
//		labelsButton.setBorder(new LineBorder(Color.green, 1, true));
		labelsButton.setToolTipText(Msg.getString("SettlementTransparentPanel.tooltip.labels")); //$NON-NLS-1$
		labelsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				JButton button = (JButton) evt.getSource();
				if (labelsMenu == null) {
					labelsMenu = createLabelsMenu();
				}
				labelsMenu.show(button, 0, button.getHeight());
				//repaint();
			}
		});

		labelPane.add(labelsButton);


		labelPane.add(emptyLabel);
	}
 
Example 5
Source File: SlownessReporter.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JButton createDetails(String text) {
    JButton btn = new HtmlButton(text);
    btn.setFocusable(false);
    btn.setBorder(BorderFactory.createEmptyBorder());
    btn.setBorderPainted(false);
    btn.setFocusPainted(false);
    btn.setOpaque(false);
    btn.setContentAreaFilled(false);
    btn.addActionListener(this);
    btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    return btn;
}
 
Example 6
Source File: DefaultSyntaxKit.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add all pop-up menu items to a Toolbar.  <b>You need to call the validate method
 * on the toolbar after this is done to layout the buttons.</b>
 * Only Actions which have a SMALL_ICON property will be added to the toolbar
 * There are three Configuration Keys that affect the appearance of the added buttons:
 * CONFIG_TOOLBAR_ROLLOVER, CONFIG_TOOLBAR_BORDER, CONFIG_TOOLBAR_OPAQUE
 * 
 * @param editorPane
 * @param toolbar
 */
public void addToolBarActions(JEditorPane editorPane, JToolBar toolbar) {
	String[] toolBarItems = getConfig().getPropertyList(CONFIG_TOOLBAR);
	if (toolBarItems == null || toolBarItems.length == 0) {
		toolBarItems = getConfig().getPropertyList(CONFIG_MENU);
		if (toolBarItems == null || toolBarItems.length == 0) {
			return;
		}
	}
	boolean btnRolloverEnabled = getConfig().getBoolean(CONFIG_TOOLBAR_ROLLOVER, true);
	boolean btnBorderPainted = getConfig().getBoolean(CONFIG_TOOLBAR_BORDER, false);
	boolean btnOpaque = getConfig().getBoolean(CONFIG_TOOLBAR_OPAQUE, false);
	int btnBorderSize = getConfig().getInteger(CONFIG_TOOLBAR_BORDER_SIZE, 2);
	for (String menuString : toolBarItems) {
		if (menuString.equals("-") ||
			menuString.startsWith("<") ||
			menuString.startsWith(">")) {
			toolbar.addSeparator();
		} else {
			Action action = editorPane.getActionMap().get(menuString);
			if (action != null && action.getValue(Action.SMALL_ICON) != null) {
				JButton b = toolbar.add(action);
				b.setRolloverEnabled(btnRolloverEnabled);
				b.setBorderPainted(btnBorderPainted);
				b.setOpaque(btnOpaque);
				b.setFocusable(false);
				b.setBorder(BorderFactory.createEmptyBorder(btnBorderSize,
					btnBorderSize, btnBorderSize, btnBorderSize));
			}
		}
	}
}
 
Example 7
Source File: Utility.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a button suitable for linking to another panel
 * (e.g. ColopediaPanel).
 *
 * @param text a {@code String} value
 * @param icon an {@code Icon} value
 * @param action a {@code String} value
 * @return a {@code JButton} value
 */
public static JButton getLinkButton(String text, Icon icon, String action) {
    JButton button = new JButton(text, icon);
    button.setMargin(EMPTY_MARGIN);
    button.setOpaque(false);
    button.setForeground(LINK_COLOR);
    button.setAlignmentY(0.8f);
    button.setBorder(blankBorder(0, 0, 0, 0));
    button.setActionCommand(action);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    return button;
}
 
Example 8
Source File: RSSFeed.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent buildProxyPanel() {
    Component header = getContentHeader();
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque( false );

    int row = 0;
    if( null != header ) {
        panel.add( header,  new GridBagConstraints(0,row++,1,1,1.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
    }

    panel.add( new JLabel(BundleSupport.getLabel("ErrCannotConnect")),  // NOI18N
            new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    if( showProxyButton ) {
        JButton button = new JButton();
        Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "ProxyConfig" ) );  // NOI18N
        button.setOpaque( false );
        button.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                HttpProxySettings.getDefault().showConfigurationDialog();
            }
        });
        panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    }
    return panel;
}
 
Example 9
Source File: RSSFeed.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent buildErrorLabel() {
    Component header = getContentHeader();
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque( false );

    int row = 0;
    if( null != header ) {
        panel.add( header,  new GridBagConstraints(0,row++,1,1,1.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
    }

    panel.add( new JLabel(BundleSupport.getLabel("ErrLoadingFeed")),  // NOI18N
            new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    JButton button = new JButton();
    Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "Reload" ) );  // NOI18N
    button.setOpaque( false );
    button.addActionListener( new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            lastReload = 0;
            reload();
        }
    });
    panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    return panel;
}
 
Example 10
Source File: DashboardToolbar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void addButton(JButton button) {
    button.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
    button.setBorderPainted(false);
    button.setFocusable(false);
    button.setOpaque(false);
    add(button);
}
 
Example 11
Source File: TerminalContainerTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initToolbar() {
    Insets ins = actionsBar.getMargin();
    JButton dummy = new JButton();
    dummy.setBorderPainted(false);
    dummy.setOpaque(false);
    dummy.setText(null);
    dummy.setIcon(new Icon() {

        @Override
        public int getIconHeight() {
            return 16;
        }

        @Override
        public int getIconWidth() {
            return 16;
        }

        @SuppressWarnings(value = "empty-statement")
        @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
            ;
        }
    });
    actionsBar.add(dummy);
    Dimension buttonPref = dummy.getPreferredSize();
    Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
    actionsBar.setMinimumSize(minDim);
    actionsBar.setPreferredSize(minDim);
    actionsBar.remove(dummy);
    actionsBar.setBorder(new RightBorder());
    actionsBar.setBorderPainted(true);
}
 
Example 12
Source File: PalettePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void prepareSearchPanel() {
    if( searchpanel == null ) {
        searchpanel = new SearchPanel();

        JLabel lbl = new JLabel(NbBundle.getMessage(PalettePanel.class, "LBL_QUICKSEARCH")); //NOI18N
        searchpanel.setLayout(new GridBagLayout());
        searchpanel.add(lbl, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(searchTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(new JLabel(), new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
        lbl.setLabelFor(searchTextField);
        searchTextField.setColumns(10);
        searchTextField.setMaximumSize(searchTextField.getPreferredSize());
        searchTextField.putClientProperty("JTextField.variant", "search"); //NOI18N
        lbl.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));

        JButton btnCancel = new JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/palette/resources/cancel.png", true));
        btnCancel.setBorder(BorderFactory.createEmptyBorder());
        btnCancel.setBorderPainted(false);
        btnCancel.setOpaque(false);
        btnCancel.setContentAreaFilled(false);
        searchpanel.add(btnCancel, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        btnCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                removeSearchField();
            }
        });
    }
}
 
Example 13
Source File: ClassPresenterPanel.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private void initComponents() {
    Color borderColor = UIManager.getLookAndFeel().getID().equals("Metal") ? // NOI18N
        UIManager.getColor("Button.darkShadow") : UIManager.getColor("Button.shadow"); // NOI18N
    setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createLineBorder(borderColor), BorderFactory.createEmptyBorder(2, 5, 2, 5)));
    setOpaque(true);
    setBackground(UIUtils.getDarker(UIUtils.getProfilerResultsBackground()));

    headerRenderer = new HeaderRenderer();
    headerRenderer.setIcon(ICON_CLASS);
    headerRenderer.setForeground(UIManager.getColor("ToolTip.foreground")); // NOI18N
    headerRenderer.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    headerRenderer.setOpaque(false);

    detailsRenderer = new JLabel();
    detailsRenderer.setForeground(UIManager.getColor("ToolTip.foreground")); // NOI18N
    detailsRenderer.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    detailsRenderer.setOpaque(false);
    
    actionsDivider = new JLabel("  |  "); // NOI18N
    actionsDivider.setForeground(UIManager.getColor("ToolTip.foreground")); // NOI18N
    actionsDivider.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    actionsDivider.setOpaque(false);

    actionsRenderer = new JButton() {
        protected void fireActionPerformed(ActionEvent e) {
            if (heapFragmentWalker != null) {
                BrowserUtils.performTask(new Runnable() {
                    public void run() {
                        heapFragmentWalker.computeRetainedSizes(true, true);
                    }
                });
            }
        }
        public Dimension getMinimumSize() {
            return getPreferredSize();
        }
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
        public void setVisible(boolean visible) {
            super.setVisible(visible);
            actionsDivider.setVisible(visible);
        }
        public boolean isContentAreaFilled() {
            return !UIUtils.isOracleLookAndFeel() ? false : isFocusOwner();
        }
        public boolean isOpaque() {
            return !UIUtils.isOracleLookAndFeel() ? false : isFocusOwner();
        }
    };
    actionsRenderer.setOpaque(false);
    actionsRenderer.setContentAreaFilled(false);
    actionsRenderer.setBorderPainted(true);
    actionsRenderer.setMargin(new Insets(0, 0, 0, 0));
    actionsRenderer.setBorder(BorderFactory.createEmptyBorder());
    actionsRenderer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    actionsRenderer.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    actionsRenderer.setText("<html><nobr><a href='#'>" + Bundle.ClassPresenterPanel_RetainedSizesString() + "</a></nobr></html>"); // NOI18N
    actionsRenderer.setVisible(false);

    JPanel detailsContainer = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    detailsContainer.setOpaque(false);
    detailsContainer.add(detailsRenderer);
    detailsContainer.add(actionsDivider);
    detailsContainer.add(actionsRenderer);
    
    setLayout(new GridBagLayout());
    
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    add(headerRenderer, c);
    
    JPanel filler = new JPanel(null);
    filler.setOpaque(false);
    c = new GridBagConstraints();
    c.gridx = 1;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    add(filler, c);
    
    c = new GridBagConstraints();
    c.gridx = 2;
    add(detailsContainer, c);
}
 
Example 14
Source File: TextActivityBase.java    From jclic with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void buildVisualComponents() throws Exception {

  super.buildVisualComponents();

  if (acp != null) {
    TextActivityContentKit kit = new TextActivityContentKit(tad, checkButtonText, prevScreenText);
    if (acp.generateContent(kit, ps)) {
      checkButtonText = kit.checkButtonText;
      prevScreenText = kit.prevScreenText;
    }
  }

  if (prevScreen == true && prevScreenText != null) {
    prevScreenDocument = new DefaultStyledDocument();
    TextActivityDocument.boxBaseToStyledDocument(prevScreenStyle, prevScreenDocument);
    try {
      prevScreenDocument.insertString(0, prevScreenText, null);
    } catch (Exception e) {
      System.err.println("Error displaying initial screen:\n" + e);
    }
  }

  pane = buildPane();

  scrollPane = new JScrollPane(pane);
  scrollPane.setBorder(BorderFactory.createEmptyBorder());
  scrollPane.getVerticalScrollBar().setBorder(BorderFactory.createLineBorder(Color.darkGray, 1));
  add(scrollPane);

  if (hasCheckButton) {
    checkButton = new JButton(StrUtils.secureString(checkButtonText, " "));
    checkButton.setOpaque(false);
    checkButton.addActionListener(this);
    add(checkButton);
  }

  if (prevScreen && prevScreenMaxTime > 0) {
    prevScreenTimer = new javax.swing.Timer(1000 * prevScreenMaxTime, this);
    prevScreenTimer.setRepeats(false);
  }
}
 
Example 15
Source File: UnitToolBar.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected JButton createActionComponent(Action a) {
	JButton jb = super.createActionComponent(a);
	jb.setOpaque(false);
	return jb;
}
 
Example 16
Source File: AnimationController.java    From pumpernickel with MIT License 4 votes vote down vote up
/**
 * Format animation controls and add them to a container. This includes
 * assigning the borders of all the components, assigning the PanelUI of the
 * container, assigning the preferred size of the container, and making a
 * spacebar on the slider trigger the toggle play button.
 * 
 * @param container
 *            this container is emptied, assigned a GridBagLayout, and the
 *            other arguments are added to this container.
 * @param togglePlayButton
 *            this button will be the left-most button. It is expected to
 *            always be visible.
 * @param buttons
 *            an optional collection of buttons to display after the
 *            togglePlayButton.
 * @param slider
 *            the slider that stretches to fill the remaining width.
 */
public static void format(JPanel container, final JButton togglePlayButton,
		JButton[] buttons, JSlider slider) {
	if (buttons == null)
		buttons = new JButton[] {};
	container.setUI(new GradientPanelUI(new Color(0xebebeb), Color.white));
	container.removeAll();
	container.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 0;
	c.weighty = 1;
	c.fill = GridBagConstraints.VERTICAL;
	container.add(togglePlayButton, c);
	for (int a = 0; a < buttons.length; a++) {
		c.gridx++;
		container.add(buttons[a], c);
		buttons[a].setOpaque(false);
		buttons[a].setContentAreaFilled(false);
		buttons[a].setRolloverIcon(new DarkenedIcon(buttons[a], .5f));
		buttons[a].setPressedIcon(new DarkenedIcon(buttons[a], .75f));
		buttons[a].setBorder(new PartialLineBorder(Color.gray, new Insets(
				1, 0, 1, 1)));
	}
	c.weightx = 1;
	c.gridx++;
	c.fill = GridBagConstraints.BOTH;
	container.add(slider, c);

	togglePlayButton.setOpaque(false);
	togglePlayButton.setContentAreaFilled(false);
	togglePlayButton.setBorder(new LineBorder(Color.gray));
	slider.setOpaque(false);
	slider.setBorder(new PartialLineBorder(Color.gray, new Insets(1, 0, 1,
			1)));
	Dimension d = slider.getPreferredSize();
	d.width = 60;
	d.height = 25;
	slider.setPreferredSize((Dimension) d.clone());
	d.width = d.height;
	togglePlayButton.setPreferredSize(d);
	for (int a = 0; a < buttons.length; a++) {
		buttons[a].setPreferredSize(d);
	}

	InputMap inputMap = slider.getInputMap(JComponent.WHEN_FOCUSED);
	inputMap.put(KeyStroke.getKeyStroke(' '), "togglePlay");
	slider.getActionMap().put("togglePlay", new AbstractAction() {
		private static final long serialVersionUID = 1L;

		public void actionPerformed(ActionEvent e) {
			togglePlayButton.doClick();
		}
	});

	togglePlayButton.setFocusPainted(false);
	setInsetFocusBorder(togglePlayButton);
	for (JButton button : buttons) {
		button.setFocusPainted(false);
		setInsetFocusBorder(button);
	}
	setInsetFocusBorder(slider);
}
 
Example 17
Source File: BeltColumnStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		JFreeChart chartOrNull = getModel().getChartOrNull(i);
		if (chartOrNull != null) {
			final ChartPanel chartPanel = new ChartPanel(chartOrNull) {

				private static final long serialVersionUID = -6953213567063104487L;

				@Override
				public Dimension getPreferredSize() {
					return DIMENSION_CHART_PANEL_ENLARGED;
				}
			};
			chartPanel.setPopupMenu(null);
			chartPanel.setBackground(COLOR_TRANSPARENT);
			chartPanel.setOpaque(false);
			chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
			panel.add(chartPanel, BorderLayout.CENTER);

			JPanel openChartPanel = new JPanel(new GridBagLayout());
			openChartPanel.setOpaque(false);

			GridBagConstraints gbc = new GridBagConstraints();
			gbc.anchor = GridBagConstraints.CENTER;
			gbc.fill = GridBagConstraints.NONE;
			gbc.weightx = 1.0;
			gbc.weighty = 1.0;

			JButton openChartButton = new JButton(OPEN_CHART_ACTION);
			openChartButton.setOpaque(false);
			openChartButton.setContentAreaFilled(false);
			openChartButton.setBorderPainted(false);
			openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
			openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
			openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
			openChartButton.setIcon(null);
			Font font = openChartButton.getFont();
			Map attributes = font.getAttributes();
			attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
			openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

			openChartPanel.add(openChartButton, gbc);

			panel.add(openChartPanel, BorderLayout.SOUTH);
		}
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 18
Source File: WidgetHelper.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
public static void setTransparent(JButton btn) {
    btn.setOpaque(false);
    btn.setContentAreaFilled(false);
    btn.setBorderPainted(false);
    btn.setBorder(null);
}
 
Example 19
Source File: AttributeStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

			private static final long serialVersionUID = -6953213567063104487L;

			@Override
			public Dimension getPreferredSize() {
				return DIMENSION_CHART_PANEL_ENLARGED;
			}
		};
		chartPanel.setPopupMenu(null);
		chartPanel.setBackground(COLOR_TRANSPARENT);
		chartPanel.setOpaque(false);
		chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		panel.add(chartPanel, BorderLayout.CENTER);

		JPanel openChartPanel = new JPanel(new GridBagLayout());
		openChartPanel.setOpaque(false);

		GridBagConstraints gbc = new GridBagConstraints();
		gbc.anchor = GridBagConstraints.CENTER;
		gbc.fill = GridBagConstraints.NONE;
		gbc.weightx = 1.0;
		gbc.weighty = 1.0;

		JButton openChartButton = new JButton(OPEN_CHART_ACTION);
		openChartButton.setOpaque(false);
		openChartButton.setContentAreaFilled(false);
		openChartButton.setBorderPainted(false);
		openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
		openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
		openChartButton.setIcon(null);
		Font font = openChartButton.getFont();
		Map attributes = font.getAttributes();
		attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
		openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

		openChartPanel.add(openChartButton, gbc);

		panel.add(openChartPanel, BorderLayout.SOUTH);
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 20
Source File: LuckTitlePanel.java    From littleluck with Apache License 2.0 3 votes vote down vote up
/**
 * <p>设置按钮属性</p>
 *
 * <p>set window button attribute</p>
 *
 * @param btn
 */
protected void setBtnAtrr(JButton btn)
{
    btn.setOpaque(false);

    btn.setBorder(null);

    btn.setFocusPainted(false);

    btn.setFocusable(false);

    btn.setBackground(null);

    btn.setContentAreaFilled(false);
}