Have you tried setting JButton.setOpaque(true)?
JButton button = new JButton("test"); button.setBackground(Color.RED); button.setOpaque(true);
Related Posts:
- How change the color arrowIcon to JMenu when it is selected
- MacOS Catalina(v 10.15.3): Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser
- Getting a HeadlessException: No X11 DISPLAY variable was set
- error upon assigning Layout: BoxLayout can’t be shared
- How to set or change the default Java (JDK) version on macOS?
- How do I draw a triangle?
- Java: Rotating Images
- How to set JAVA_HOME environment variable on Mac OS X 10.9?
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- JOptionPane YES NO OPTION
- How do I draw a triangle?
- What does “AL lib: alc_cleanup: 1 device not closed” mean?
- Java GUI: about getContentPane( ) method and content
- How to center the text in a JLabel?
- How to add an image to a JPanel?
- How to repaint a JPanel after have drawn on it?
- Implementing an actionlistener to a JTextField
- How to Set JPanel’s Width and Height?
- addMouseListener for a JPanel
- Swing/Java: How to use the getText and setText string properly
- What does super.paintComponent(g) do?
- Java Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
- Popup Message boxes
- Exception in thread “AWT-EventQueue-0”?
- make a JLabel wrap it’s text by setting a max width
- Keylistener not working for JPanel
- setMnemonic() and call a method by pressing the key
- the getSource() and getActionCommand()
- How to programmatically close a JFrame
- How does addNotify() and requestFocus() work in Java with JPanel?
- DTO and DAO concepts and MVC
- Adding JPanel to JFrame
- Adding image to JFrame
- How to Retrieve value from JTextField in Java Swing?
- Setting background color for a JFrame
- What does .pack() do?
- Setting background images in JFrame
- Java Swing revalidate() vs repaint()
- How does paintComponent work?
- How can I set size of a button?
- Java Swing setting JPanel Size
- How to draw a circle with given X and Y coordinates as the middle spot of the circle?
- Class JavaLaunchHelper is implemented in two places
- JOptionPane Yes or No window
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- What is a StackOverflowError?
- How to uninstall Eclipse?
- How do I determine whether an array contains a particular value in Java?
- How can I solve Exception in thread “main” java.lang.NullPointerException error [duplicate]
- Why am I getting a NoClassDefFoundError in Java?
- How to avoid “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it? [duplicate]
- Using Pairs or 2-tuples in Java [duplicate]
- Error occurred during initialization of boot layer FindException: Module not found
- Java: Multiple class declarations in one file
- Why do JVM arguments start with “-D”?
- How to split a string in Java
- Printing out a linked list using toString
- Received fatal alert: handshake_failure through SSLHandshakeException
- How to identify object types in java
- What is the result of making log4j additivity equals to true or false?
- Attempt to invoke virtual method ‘…’ on a null object reference
- Is there a Mutex in Java?
- maven error: package org.junit does not exist
- ClassNotFoundException: org.slf4j.LoggerFactory
- Only using @JsonIgnore during serialization, but not deserialization
- Cannot change version of project facet Dynamic Web Module to 3.0?
- InvalidKeyException Illegal key size
- Collections.emptyMap() vs new HashMap()
- java howto ArrayList push, pop, shift, and unshift
- Error Message: Can’t determine a valid Java Home
- Counting an Occurrence in an Array (Java)
- When is the finalize() method called in Java?
- Java “user.dir” property – what exactly does it mean?
- it throws me error incompatible types: unexpected return value — return 10; please correct it make note where i am doing wrong code?
- Caused by: java.security.UnrecoverableKeyException: Cannot recover key
- How can I truncate a double to only two decimal places in Java?
- How do I add a simple jQuery script to WordPress?
- I get the error int cannot be converted to boolean?c
- Can’t install JDK 9 because “Another Java installation is in progress”
- java.sql.SQLException: No database selected – why?
- Sending mail error, javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
- Cannot issue data manipulation statements with executeQuery()
- Why do some classes require main methods and others do not?
- java.util.IllegalFormatConversionException
- What do F and D mean at the end of numeric literals?
- what is the difference between doGet() and doPost() in term of the flow?
- Java 3D Game Engine?
- How to cast ArrayList<> from List<>
- Using insertion sort for descending order?
- What is the home directory for JDK?
- java.lang.ClassNotFoundException: org.postgresql.Driver, Android
- Javadoc @author tag good practices
- A fatal error has been detected by the Java Runtime Environment: SIGSEGV, libjvm
- java.lang.IllegalStateException: Failed to introspect Class
- ShoppingCart.Java Program Assignment
- White spaces are required between publicId and systemId
- Http status 401 This request requires HTTP authentication (). in tomcat 6
- Get integer value of the current year in Java
- How to make the division of 2 ints produce a float instead of another int?
- Java Console Prompt for ENTER input before moving on [duplicate]