本文整理了Java中javax.swing.JButton.getBackground()
方法的一些代码示例,展示了JButton.getBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.getBackground()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:getBackground
暂无
代码示例来源:origin: runelite/runelite
@Override
public void mouseClicked(MouseEvent e)
{
RuneliteColorPicker colorPicker = new RuneliteColorPicker(SwingUtilities.windowForComponent(ConfigPanel.this),
colorPickerBtn.getBackground(), cid.getItem().name(), cid.getAlpha() == null);
colorPicker.setLocation(getLocationOnScreen());
colorPicker.setOnColorChange(c ->
{
colorPickerBtn.setBackground(c);
colorPickerBtn.setText(ColorUtil.toHexColor(c).toUpperCase());
});
colorPicker.addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
changeConfiguration(listItem, config, colorPicker, cd, cid);
}
});
colorPicker.setVisible(true);
}
});
代码示例来源:origin: robo-code/robocode
@Override
public void stateChanged(ChangeEvent e) {
if (!coloredButton.getBackground().equals(color)) {
notifyColorChanged(coloredButton.getBackground());
}
}
});
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e)
{
JButton button = (JButton)e.getSource();
color = button.getBackground();
repaint();
}
代码示例来源:origin: stackoverflow.com
private class matrixButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JButton btn = (JButton) (e.getSource());
if (btn.getBackground() == COLOR_NEUTRAL)
{
btn.setBackground(COLOR_PLAYER);
}
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = BACKGROUND_JSDOC)
@Override
public Color getBackground() {
return super.getBackground();
}
代码示例来源:origin: uk.ac.gate.plugins/tools
void selectNode(MouseEvent e) {
// try finding the node that's annotated, i.e., the selected button
if (e.getSource() instanceof JButton) {
JButton source = (JButton) e.getSource();
selection.add(source);
buttonBackground = source.getBackground();
source.setBackground(selectedNodeColor);
}
}
代码示例来源:origin: stackoverflow.com
`public void flipIt(JButton button){
if(button.getBackground().equals(Color.white)){
button.setBackground(Color.yellow);
} else if (button.getBackground().equals(Color.yellow)){
button.setBackground(Color.white);
}
}'
代码示例来源:origin: freeplane/freeplane
/**
* Initilizes the locale specific names for the days of the week.
*/
protected void init() {
final JButton testButton = new JButton();
oldDayBackgroundColor = testButton.getBackground();
selectedColor = new Color(160, 160, 160);
final Date date = calendar.getTime();
calendar = Calendar.getInstance(locale);
calendar.setTime(date);
drawDayNames();
drawDays();
}
代码示例来源:origin: stackoverflow.com
@Override
public void actionPerformed(ActionEvent e) {
Object eventSource = e.getSource();
if (eventSource instanceof JButton) {
JButton buttonClicked = (JButton) eventSource;
Color bg = buttonClicked.getBackground();
if (bg.equals(Color.white)) {
buttonClicked.setBackground(Color.yellow);
} else if (bg.equals(Color.yellow)) {
buttonClicked.setBackground(Color.white);
}
}
}
代码示例来源:origin: Exslims/MercuryTrade
@Override
public void mouseEntered(MouseEvent e) {
this.prevBorder = button.getBorder();
CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(AppThemeColor.ADR_SELECTED_BORDER, 1),
BorderFactory.createLineBorder(button.getBackground(), 3)
);
button.setBorder(compoundBorder);
button.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
代码示例来源:origin: IanDarwin/javasrc
/** Unset any previously highlighted day */
private void clearDayActive() {
JButton b;
// First un-shade the previously-selected square, if any
if (activeDay > 0) {
b = labs[(leadGap+activeDay-1)/7][(leadGap+activeDay-1)%7];
b.setBackground(b0.getBackground());
b.repaint();
activeDay = -1;
}
}
代码示例来源:origin: datacleaner/DataCleaner
public int getSelectedIndex() {
int i = 0;
for (final VerticalTab<?> tab : _tabs) {
final JButton button = tab.getButton();
if (button.getForeground() == COLOR_SELECTED_FOREGROUND
&& button.getBackground() == COLOR_SELECTED_BACKGROUND) {
return i;
}
i++;
}
return -1;
}
代码示例来源:origin: robo-code/robocode
@Override
public void actionPerformed(ActionEvent e) {
Color selectedColor = JColorChooser.showDialog(null, "Pick a color", button.getBackground());
if (selectedColor != null) {
button.setBackground(selectedColor);
}
}
});
代码示例来源:origin: IanDarwin/javasrc
/** Unset any previously highlighted day */
private void clearDayActive() {
JButton b;
// First un-shade the previously-selected square, if any
if (activeDay > 0) {
b = labs[(leadGap+activeDay)/7][(leadGap+activeDay)%7];
b.setBackground(b0.getBackground());
b.repaint();
activeDay = -1;
}
}
代码示例来源:origin: nroduit/Weasis
public static void openColorChooser(JButton button) {
if (button != null) {
Color newColor =
JColorChooser.showDialog(button, Messages.getString("MeasureTool.pick_color"), button.getBackground()); //$NON-NLS-1$
if (newColor != null) {
button.setBackground(newColor);
}
}
}
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/**
* Updates the drawing due to changes made on this panel.
*/
private void updateDrawing() {
if (drawing != null) {
drawing.willChange();
drawing.fireUndoableEditHappened(
CANVAS_FILL_COLOR.setUndoable(drawing, colorButton.getBackground())
);
drawing.changed();
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public Color getBackground()
{
Color r;
if(isEnabled()&&model.isRollover()&&BuLib.isMetal())
r=new ColorUIResource(192,192,208);
else
r=super.getBackground();
return r;
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public Color getBackground()
{
Color r;
if(isEnabled()&&getModel().isRollover()&&BuLib.isMetal())
r=new ColorUIResource(192,192,208);
else
r=super.getBackground();
return r;
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public Color getBackground()
{
Color r;
if(isEnabled()&&getModel().isRollover()&&BuLib.isMetal())
r=new ColorUIResource(192,192,208);
else
r=super.getBackground();
return r;
}
}
代码示例来源:origin: triplea-game/triplea
BattleTable(final BattleModel model) {
super(model);
setDefaultRenderer(Object.class, new Renderer());
setRowHeight(UnitImageFactory.DEFAULT_UNIT_ICON_SIZE + 5);
setBackground(new JButton().getBackground());
setShowHorizontalLines(false);
getTableHeader().setReorderingAllowed(false);
// getTableHeader().setResizingAllowed(false);
}
}
内容来源于网络,如有侵权,请联系作者删除!