Skip to content
Advertisement

Tag: swing

Unexpected behavior of FlowLayout

I’m using JPanel with a default FlowLayout layout manager. I think in case the application window was resized and there is not enough width to show all components in JPanel in one row, some components will be moved to another row(s). This assumption is based on the documentation: If the horizontal space in the container is too small to put

Java: How got check colors from an invisible panel

is it possible to read colors of you mouse position of an invisible panel? I want to have an “invisible overlay” with an color coded image. I used the Robot class to get my mouse position and the color. It works fine on my visible image, but if I set the image to invisible, it completely gets ignored. Is there

Java JFrame button organization

How do i create a jframe that organizes the text box and jbuttons, with the textbox on top and a 3 by 4 grid layout of buttons 1-10? This is what I have so far: But that’s where I’m stuck. Okay I should note that I need a for loop to populate 3 by 4 gridlayout. But I don’t know

How to deal with “cannot be cast to class” error – GSON JAVA

i am trying to write my list to jtable in abstract model and then its return to me this error. In my opinion it could be cause by list format? name and amount are in wrong place. This is my full error message: Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: class com.google.gson.internal.LinkedTreeMap cannot be cast to class Model.Medicine (com.google.gson.internal.LinkedTreeMap and Model.Medicine are

Scaling shape with frame size

I’m new to Java and I’m playing around with a simple GUI example. After having received a good answer to my last question, I tried to take it one step further and to scale the shape with the frame size (with fixed aspect ratio). Indeed, when I change the window size, the shape scales with it. However, the shape never

Advertisement