Java Code Examples for javax.swing.JToggleButton#setContentAreaFilled()
The following examples show how to use
javax.swing.JToggleButton#setContentAreaFilled() .
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: ActionFactory.java From netbeans with Apache License 2.0 | 5 votes |
void updateState() { JEditorPane pane = getPane(); if (pane != null) { boolean rectangleSelection = RectangularSelectionUtils.isRectangularSelection(pane); JToggleButton toggleButton = getToggleButton(); if (toggleButton != null) { toggleButton.setSelected(rectangleSelection); toggleButton.setContentAreaFilled(rectangleSelection); toggleButton.setBorderPainted(rectangleSelection); } } }
Example 2
Source File: PaletteUI.java From pumpernickel with MIT License | 5 votes |
private JToggleButton createCell() { JToggleButton newCell = new JToggleButton(); newCell.addMouseListener(mouseListener); newCell.addMouseMotionListener(mouseListener); newCell.setContentAreaFilled(false); newCell.setBorder(null); newCell.setRequestFocusEnabled(false); newCell.setBorderPainted(false); newCell.setOpaque(false); newCell.putClientProperty(PROPERTY_CELL, Boolean.TRUE); newCell.addActionListener(cellActionListener); return newCell; }
Example 3
Source File: Desing$CodeSwitcherPane.java From DroidUIBuilder with Apache License 2.0 | 5 votes |
private void initGUI() { // 实例化按钮 ButtonGroup bg = new ButtonGroup(); btnLeft = new JToggleButton(""); btnRight = new JToggleButton(""); btnLeft.setContentAreaFilled(false); btnLeft.setFocusable(false); btnLeft.setBorder(null); btnLeft.setPreferredSize(new Dimension(64,25)); btnRight.setContentAreaFilled(false); btnRight.setFocusable(false); btnRight.setBorder(null); btnRight.setPreferredSize(new Dimension(64,25)); // 加入到ButtonGroup(实现RadioButton的形为) bg.add(btnLeft); bg.add(btnRight); // 主面板布局 FlowLayout mainLayout = new FlowLayout(FlowLayout.CENTER); mainLayout.setHgap(0); mainLayout.setVgap(2); this.setLayout(mainLayout); // 此处的border的设置是为了背景上部的装饰而做哦 this.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); // 实例化按钮面板 btnPane = new BtnPane(); btnPane.add(btnLeft); btnPane.add(btnRight); // 添加到总体布局中 this.add(btnPane); }