Refine search
JButton button = new JButton("test"); button.setBackground(Color.RED); button.setOpaque(true);
JButton button = new JButton(); button.setBackground(Color.red); button.setOpaque(true); button.setBorderPainted(false);
private JButton createButton(Lecture lecture, Color color, String toolTip) { JButton button = SwingUtils.makeSmallButton(new JButton(new LectureAction(lecture))); button.setBackground(color); if (lecture.isPinned()) { button.setIcon(CommonIcons.PINNED_ICON); } button.setToolTipText(toolTip); return button; }
private JButton createButton(MeetingAssignment meetingAssignment, Color color) { JButton button = SwingUtils.makeSmallButton(new JButton(new MeetingAssignmentAction(meetingAssignment))); button.setBackground(color); return button; }
private JButton createButton(Exam exam, Color color, String toolTip) { JButton button = SwingUtils.makeSmallButton(new JButton(new ExamAction(exam))); button.setBackground(color); button.setToolTipText(toolTip); if (exam instanceof FollowingExam) { button.setForeground(TangoColorFactory.ALUMINIUM_5); } return button; }
private JButton createButton(TeamAssignment teamAssignment, Color color) { JButton button = SwingUtils.makeSmallButton(new JButton(new TeamAssignmentAction(teamAssignment))); button.setBackground(color); if (teamAssignment.isPinned()) { button.setIcon(CommonIcons.PINNED_ICON); } return button; }
private JButton createButton(Match match, Team team, Team otherTeam, String toolTip) { Color color = determinePlanningEntityColor(match, otherTeam); String label = otherTeam.getLabel(); JButton button = SwingUtils.makeSmallButton(new JButton(new MatchAction(match, label))); if (match.getAwayTeam() == team) { button.setIcon(awayMatchIcon); } button.setBackground(color); button.setToolTipText(toolTip); return button; }
public void addShiftAssignment(ShiftAssignment shiftAssignment) { Shift shift = shiftAssignment.getShift(); JPanel shiftPanel = shiftPanelMap.get(shift); JButton shiftAssignmentButton = SwingUtils.makeSmallButton(new JButton(new ShiftAssignmentAction(shiftAssignment))); shiftAssignmentButton.setEnabled(shiftPanel.isEnabled()); if (employee != null) { if (employee.getDayOffRequestMap().containsKey(shift.getShiftDate()) || employee.getShiftOffRequestMap().containsKey(shift)) { shiftAssignmentButton.setForeground(TangoColorFactory.SCARLET_1); } } Color color = nurseRosteringPanel.determinePlanningEntityColor(shiftAssignment, shift.getShiftType()); shiftAssignmentButton.setBackground(color); String toolTip = nurseRosteringPanel.determinePlanningEntityTooltip(shiftAssignment); shiftAssignmentButton.setToolTipText(toolTip); shiftPanel.add(shiftAssignmentButton); shiftPanel.repaint(); shiftAssignmentButtonMap.put(shiftAssignment, shiftAssignmentButton); }
private JButton createTaskButton(Task task) { JButton taskButton = SwingUtils.makeSmallButton(new JButton(new TaskAction(task))); taskButton.setBackground(task.isPinned() ? TangoColorFactory.ALUMINIUM_3 : TangoColorFactory.ALUMINIUM_1); taskButton.setHorizontalTextPosition(SwingConstants.CENTER); taskButton.setVerticalTextPosition(SwingConstants.TOP); taskButton.setSize(task.getDuration(), ROW_HEIGHT); return taskButton; }
colorPickerBtn = new JButton("Pick a color"); colorPickerBtn = new JButton(ColorUtil.toHexColor(existingColor).toUpperCase()); colorPickerBtn.setBackground(existingColor); colorPickerBtn.addMouseListener(new MouseAdapter() JButton resetButton = new JButton("Reset"); resetButton.addActionListener((e) ->
private static JButton createSimpleButton(String text) { JButton button = new JButton(text); button.setForeground(Color.BLACK); button.setBackground(Color.WHITE); Border line = new LineBorder(Color.BLACK); Border margin = new EmptyBorder(5, 15, 5, 15); Border compound = new CompoundBorder(line, margin); button.setBorder(compound); return button; }
for(int i=1;i<=9;i++) { JButton btn = new JButton(String.valueOf(i)); btn.setBackground(Color.BLACK); btn.setForeground(Color.GRAY); p3.add(btn); }
lastLine.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); this.buttonClose = new JButton("Close"); this.buttonClose.setBorder(BorderFactory.createCompoundBorder( HelperUi.BORDER_FOCUS_GAINED, Container dialogPane = this.getContentPane(); final JButton buttonWebpage = new JButton("Webpage"); buttonWebpage.setBorder(BorderFactory.createCompoundBorder( HelperUi.BORDER_FOCUS_GAINED, buttonWebpage.setBackground(new Color(200, 221, 242)); this.buttonClose.setBackground(new Color(200, 221, 242));
public static JXPanel getDescription(CardView card, int width, int height) { JXPanel descriptionPanel = new JXPanel(); //descriptionPanel.setAlpha(.8f); descriptionPanel.setBounds(0, 0, width, height); descriptionPanel.setVisible(false); descriptionPanel.setLayout(null); //descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green)); JButton j = new JButton(""); j.setBounds(0, 0, width, height); j.setBackground(Color.black); j.setLayout(null); JLabel cardText = new JLabel(); cardText.setBounds(5, 5, width - 10, height - 10); cardText.setForeground(Color.white); cardText.setFont(cardNameFont); cardText.setVerticalAlignment(SwingConstants.TOP); j.add(cardText); TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card); cardText.setText(getRulefromCardView(card, textLines).toString()); descriptionPanel.add(j); return descriptionPanel; }
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); JButton buttonCollect = new JButton("collect"); buttonCollect.setPreferredSize(new Dimension(100, 30)); buttonCollect.setEnabled(false); buttonBase = new JButton("base"); buttonBase.setPreferredSize(new Dimension(100, 30)); buttonBase.setEnabled(true); buttonTrain = new JButton("train"); buttonTrain.setPreferredSize(new Dimension(100, 30)); buttonTrain.setEnabled(false); buttonTrain.setBackground(Color.cyan.darker()); buttonRecord.setPreferredSize(new Dimension(100, 30)); buttonRecord.setEnabled(true); buttonRecord.setBackground(new Color(60, 255, 120));
JButton button1 = MakeGameButton(...); JButton button2 = MakeGameButton(...); JButton buttonA = new JButton("A Button"); buttonA.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ button1.setBackground(...); } });
public class Jbutton { public static void main (String[] args){ //You're going to need some context for this like a JFrame JButton button = new JButton("I'm colorful!"); button.setBackground(Color.RED); } }
private newButton(String label, Color background) { JButton button = new JButton(label); button.setBackground(background); return button; }
JButton b = new JButton("foo"); b.addMouseListener(new MouseAdapter(){ @Override public void mousePressed(MouseEvent e) { b.setBackground(Color.red); } @Override public void mouseReleased(MouseEvent e) { //go back to original state } });
for (int i = 0; i < 20; i++) { final JButton btnBookFlight = new JButton("Book" + i); btnBookFlight.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnBookFlight.setBackground(Color.RED); ... } }); }