Create smooth gradient with HSB in java

I’m trying to create a sorting algorithm visualiser in greenfoot java, with an array shown as a column graph. I want it to be colourful, so I’m using a colour gradient like shown in this video https://…

Why is the swing gui behaving strange?

I just started making my Java application on Minesweeper. The idea is a GridLayout JPanel inside a JFrame. But after executing the program I get some weird window. There is this strange gray corner on …

Swing – How to modify the border color of a JButton?

How to modify the border color of a JButton? I want to get something like this: But I canĀ“t modify the color, the borde is black: And If I try to add a LineBorder or any other borde, I am not able …

Is there a way to skip a mouse click for ActionListener?

I have a Tic Tac Toe GUI that lets a user play against a computer. I use an actionListener to receive the users mouse clicks on where they want to put their “X” on the board. The problem I …

determine identification of a JCheckBox in itemListener

I have 4 check boxes, and the user can select or deselect them for their required settings, however, the program requires at least 1 check box to be checked in order to generate the required …

Curious behavior of java.awt.Component, setVisible(), LayoutManager

I was trying to create a GUI and found some curious behavior of java.awt.Component. I wanted to setVisible(true)/setVisible(false) an java.awt.Component by an external Event. But this only works when …

Moving code from ActionListener to main()

PROBLEM: I have following code for the java.awt.Button : Button btn = new Button(“abcde”); btn.addActionListener((ActionEvent e) -> { String s = btn.getLabel().toUpperCase(); btn….

how to use JTextField to show a negative or positive result using ActionListener on the JTextField itself

My program is supposed to ask a user to write a number in a JTextField and then show the result if the number is negative or positive in another JTextField that is disabled. All of that must be done …

Java AWT Window doesn’t get repainted

I’ve derived a class from window, but whenever I call setValue() (which calls repaint) it doesn’t get redrawn (the method is called, but nothing changes on the screen). The first value is drawn, which …

Cannot load font in JRE 8

I cannot load a font from an S3 Inputstream in JRE 8. I do not have issue if a system is installed with JRE 7, JDK 7, or even JDK 8. val fontInputStream = s3Client.getObject(bucketName, objectKey)….