Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Problem with gif with transparent background

Your gif is disposal = 3 that means it needs previous image as it renders incrementally. The problem is the image is with black background and not white … Here are the disposals possible: if (disposal==0) s=”no animation”; else if (disposal==1) s=”leave image as is”; else if (disposal==2) s=”clear with background”; else if (disposal==3) s=”restore … Read more

JOptionPane YES NO OPTION

You should actually take the result from the option pane: dialogButton = JOptionPane.showConfirmDialog (null, “Are you sure?”,”WARNING”, dialogButton); Otherwise, it remains set to JOptionPane.YES_NO_OPTION. Cleaner would be: if (JOptionPane.showConfirmDialog(null, “Are you sure?”, “WARNING”, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // yes option } else { // no option } Although, I’m not sure what this line is … Read more

addMouseListener for a JPanel

JPanel doesn’t have ActionListener capabilities. Instead, you need to use a MouseListener import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JPanel; public class CoordBoutons extends JFrame { CoordBoutons() { super(“GridLayout”); setDefaultCloseOperation(EXIT_ON_CLOSE); Container contenant = getContentPane(); contenant.setLayout(new GridLayout(8, 8)); for (int i = 0; i < 8; i++) { for (int … Read more

How to use Java AWT setBackground

You have added the JPanel over the JFrame which completely blocks out the underlying container on which you have set the color. You could do this instead: public Gui(String title) { super(title); JPanel pane = new JPanel(); setBounds(100, 100, 500, 500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container con = this.getContentPane(); pane.setBackground(new Color(0, 0, 0)); con.add(pane); setVisible(true); }