Skip to content
Advertisement

Tag: jpanel

How can you draw rectangles on a JPanel?

I’m trying to create a program that generates rectangles using a slider. The user should be able to move the slider and rectangles should appear on the JPanel above the slider with random positions. I have tried running the program but I’m still unable to display anything, I move the slider but nothing appears on screen. I have tried coding

How do i write a code to display every letter in every JPanel, and how do I rotate. (JFrame, NetBeans)

I’m new to Java, and I was assigned in my class to develop a code for the following question, I was only able to do the design, after that I didn’t know how to continue adding the actions to every button. This is the question: https://www.chegg.com/homework-help/questions-and-answers/write-java-application-creates-frame-similar-one-shown–four-letter-word-shown-four-panels-q52352988 If anyone has ever solved it, please share it. Thanks for help in advance!

How to scale basic drawings?

I would like to have a list of shapes, that appears in my window. Whenever I’m changing the size of the window, I would like to scale all of my drawings. I already prepared classes, that store information about random shapes in a list (rectangles, ovals, etc.). I have no problem with painting them all, but I can’t deal with

JPanel takes the entire space of JFrame

I am struggling to place some simple objects using the FlowLayout manager in Swing. Basically I have created a small program, I have set up the size of the frame, then crated some JLabels and then one JPanel. I have put the JPanel a setSize of 300×300 and changed it’s color to red to visually see it. However it takes

Advertisement