本文整理汇总了Java中javax.swing.JButton.setContentAreaFilled方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setContentAreaFilled方法的具体用法?Java JButton.setContentAreaFilled怎么用?Java JButton.setContentAreaFilled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setContentAreaFilled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDecreaseButton
import javax.swing.JButton; //导入方法依赖的package包/类
protected JButton createDecreaseButton(int orientation) {
JButton btn = new XDMButton();
btn.setHorizontalAlignment(JButton.CENTER);
btn.setPreferredSize(new Dimension(15, 15));
btn.setContentAreaFilled(false);
btn.setBorderPainted(false);
btn.setOpaque(false);
if (orientation == SwingConstants.NORTH) {
btn.setIcon(XDMIconMap.getIcon("UP_ARROW"));
}
if (orientation == SwingConstants.SOUTH) {
btn.setIcon(XDMIconMap.getIcon("DOWN_ARROW"));
}
if (orientation == SwingConstants.EAST) {
btn.setIcon(XDMIconMap.getIcon("LEFT_ARROW"));
}
if (orientation == SwingConstants.WEST) {
btn.setIcon(XDMIconMap.getIcon("RIGHT_ARROW"));
}
return btn;
}
示例2: createToolBar
import javax.swing.JButton; //导入方法依赖的package包/类
JToolBar createToolBar() {
JToolBar toolbar = new JToolBar();
next = new JButton(XDMIconMap.getIcon("NEXT_ICON"));
XDMToolBarButtonUI btnUI = new XDMToolBarButtonUI();
next.setUI(btnUI);
next.addActionListener(this);
next.setRolloverIcon(XDMIconMap.getIcon("NEXT_R_ICON"));
next.setContentAreaFilled(false);
next.setFocusPainted(false);
back = new JButton(XDMIconMap.getIcon("BACK_ICON"));
back.setUI(btnUI);
back.setContentAreaFilled(false);
back.setFocusPainted(false);
back.addActionListener(this);
back.setRolloverIcon(XDMIconMap.getIcon("BACK_R_ICON"));
toolbar.add(back);
toolbar.add(next);
return toolbar;// add(toolbar, BorderLayout.NORTH);
}
示例3: getDetailsPanel
import javax.swing.JButton; //导入方法依赖的package包/类
private static JComponent getDetailsPanel(String summary) {
JPanel details = new JPanel(new GridBagLayout());
details.setOpaque(false);
JLabel lblMessage = new JLabel(summary);
JButton reportLink = new JButton("<html><a href=\"_blank\">" + NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionReport")); //NOI18N
reportLink.setFocusable(false);
reportLink.setBorder(BorderFactory.createEmptyBorder());
reportLink.setBorderPainted(false);
reportLink.setFocusPainted(false);
reportLink.setOpaque(false);
reportLink.setContentAreaFilled(false);
reportLink.addActionListener(flash);
reportLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
details.add(reportLink, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
details.add(lblMessage, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
return details;
}
示例4: createDetails
import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createDetails( String text, ActionListener action ) {
if( null == action ) {
return new JLabel(text);
}
try {
text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N
} catch( CharConversionException ex ) {
throw new IllegalArgumentException(ex);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例5: init
import javax.swing.JButton; //导入方法依赖的package包/类
void init(){
panel=new JPanel();
panel.setLayout(new MigLayout("insets 0 5 0 0","[grow,fill]rel[right]", "[]0[]"));
panel.setOpaque(true);
panel.setBackground(color_normal);
addressLabel=new JLabel("");
panel.add(addressLabel,"");
addressLabel.setOpaque(false);
button_remove=new JButton("x");
//panel.add(button_remove,"align right");
button_remove.setOpaque(false);
button_remove.setContentAreaFilled(false);
button_remove.setBorderPainted(false);
button_remove.setMargin(new Insets(0, 10, 0, 10));
button_remove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(e);
}
});
}
示例6: stylizeButton
import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton(JButton b){
Border thickBorder = new LineBorder(Color.WHITE, 3);
b.setBorder(thickBorder);
b.setContentAreaFilled(false);
b.setOpaque(true);
b.setBackground(Color.BLACK);
b.setForeground(Color.WHITE);
}
示例7: stylizeButton
import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton(JButton b){
Border thickBorder = new LineBorder(Color.WHITE, 3);
b.setBorder(thickBorder);
b.setContentAreaFilled(false);
b.setOpaque(true);
b.setBackground(Color.BLACK);
b.setForeground(Color.WHITE);
}
示例8: prepareSearchPanel
import javax.swing.JButton; //导入方法依赖的package包/类
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();
}
});
}
}
示例9: createDetails
import javax.swing.JButton; //导入方法依赖的package包/类
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;
}
示例10: addImpl
import javax.swing.JButton; //导入方法依赖的package包/类
@Override
protected void addImpl( Component comp, Object constraints, int index ) {
super.addImpl( comp, constraints, index );
if( comp instanceof JButton ) {
JButton btn = (JButton) comp;
btn.setContentAreaFilled( false );
btn.setOpaque( false );
btn.setBorder( BorderFactory.createEmptyBorder(2,2,2,2) );
btn.setFocusable( false );
btn.setBorderPainted( false );
btn.setRolloverEnabled( false );
}
}
示例11: createHeaderButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Creates a new button for displaying on the left hand side.
*/
private JButton createHeaderButton(String text, String iconPath)
{
Icon icon = new ImageIcon(Editor.class.getResource(iconPath));
JButton button = new JButton(text, icon);
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.addActionListener(buttonListener);
return button;
}
示例12: Instructions
import javax.swing.JButton; //导入方法依赖的package包/类
public Instructions(JFrame f, int frameBoundX, int frameBoundY) {
// Font
InputStream is = Menu.class.getResourceAsStream("Cheap Potatoes.ttf");
try {
font = Font.createFont(Font.TRUETYPE_FONT, is);
} catch (FontFormatException | IOException e1) {
// TODO Auto-generated catch
// block
e1.printStackTrace();
}
//Main Panel of Instructions Section created here
JPanel instrPanel = new JPanel();
instrPanel.setLayout(null);
setBounds(0,0,frameBoundX, frameBoundY);
//Logo
JLabel logoLabel = new JLabel("GEOTRIX", SwingConstants.CENTER);
sizedFont = font.deriveFont(68f);
logoLabel.setFont(sizedFont);
logoLabel.setBounds(frameBoundX / 2 - 200, (frameBoundY-520)/ 2, 400, 190);
JButton backButton = new JButton("Back");
backButton.setBorderPainted(false);
backButton.setFocusPainted(false);
backButton.setContentAreaFilled(false);
sizedFont = font.deriveFont(Font.BOLD, 30f);
backButton.setFont(sizedFont);
backButton.setForeground(Color.RED);
backButton.setBounds(10, 10, 200, 100);
// when backButton clicked
backButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//remove panel
instrPanel.setVisible(false);
f.remove(instrPanel);
new MainMenu(f, frameBoundX, frameBoundY);
}
});
//Logo
JLabel instructionLabel = new JLabel("Arrow keys + Space button", SwingConstants.CENTER);
sizedFont = font.deriveFont(40f);
instructionLabel.setFont(sizedFont);
instructionLabel.setBounds(25, frameBoundY/2 - 100, frameBoundX - 50, 200);
instrPanel.add(instructionLabel);
//Background Icon
String img = "background_revision.jpg";
ImageIcon imgIc = new ImageIcon(this.getClass().getResource(img));
//Backgroud Label
JLabel bgLabel = new JLabel(imgIc);
bgLabel.setBounds(0, 0, frameBoundX, frameBoundY);
instrPanel.add(backButton);
instrPanel.add(logoLabel);
instrPanel.add(bgLabel);
f.add(instrPanel);
f.revalidate();
f.setVisible(true);
}
示例13: registerDrag
import javax.swing.JButton; //导入方法依赖的package包/类
private void registerDrag(JButton drag) {
drag.setContentAreaFilled(false);
drag.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
WindowMover.register(this, drag, WindowMover.MOVE_BOTH);
}
示例14: decorateAsLinkButton
import javax.swing.JButton; //导入方法依赖的package包/类
/** Removes background and border, changes cursor to hand. */
public static void decorateAsLinkButton(JButton button) {
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
示例15: updateCharts
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* 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();
}
}