Rectangle « JPanel « Java Swing Q&A





1. Changing the border of rectangle in jPanel    stackoverflow.com

I ama drawing a rectangle in a panel and i added a + button to increase my shape's size.how can i do it?

2. Moving a rectangle in Swing JPanel: original stays    stackoverflow.com

I'm trying to make a tower of hanoi solver which simply solves the hanoi without any mouse events. The problem is when I move the rectangle the original remains, even after ...

3. random rectangles on a JPanel/JPanel    stackoverflow.com

I need to create a program that displays multiple rectangles on a JFrame or JPanel. This is the code I have come up with so far:

import javax.swing.*;
import java.util.Random;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import ...

4. Drawing rectangles on a JPanel    stackoverflow.com

I have a JScrollPane and on top of it I have a JPanel named 'panel1'. I want some rectangles to be drawn on this JPanel. I have a class named DrawRectPanel which extends ...

5. Draw a shape at a known co-ordinate on JPanel    stackoverflow.com

I have searched quite bit to find a solution to my problem with no luck. I would have thought there to be a simple solution. I have the following code where ...

6. drawing a simple rectangle in a panel    coderanch.com

7. can rectangle be drawn in jpanel using awt classes    coderanch.com

i am desgning the container ship blocks, Then i tried with awt classes, vat i did is , new JPanel(){ public void paint(Graphics g){ for( int i = 1; i <=100 ; i++){ if( i <= 10 ) g.fillRect(i*10, 10, 8, 8); else if( i > 10 && i <= 20) g.fillRect((i-10)*10, 20, 8, 8); else if( i > 20 && ...

8. draw rectangle in JPanel using mouse    coderanch.com

9. painting hundreds of Rectangles in JPanel    coderanch.com

Hi ranchers! I need some advise on how to make my paintComponent go faster. I'm bulding a InDesign like program. A user can drag rectangles, change border, columns, colors on the rectangle. All rectangles have diffrent z-index so you can draw a rectangle over a rectangle. Every time the mouse is moved over the JPanel that acts like a container for ...





10. Draw a rectangle in JPanel using Mouse    coderanch.com

I'm sorry, but we don't do homework assignments for you. Please show us what you have tried so far. First of all, do you know how to create a window? Do you know how to capture mouse events? These are the two main things you will need to do in order to complete this project. If you encounter problems, please come ...

11. Drawing a rectangle in a JPanel    coderanch.com

Hello, I registered today on this forum, but I've been reading here for some time already. There have been moments where I wanted to ask a question, but I always was able to find the solution myself after some research, but now I'm stuck. I'm a total beginner in Java, but not in programming in general (I have done many projects ...

12. non-rectangle JPanel    java-forums.org

14. Question on generating random rectangles inside a JPanel    forums.oracle.com

One way is to have an ArrayList of your Rectangle objects so that as you randomly create them, you add them to the array list and call repaint on the jpanel. The JPanel's paintComponent would then have a loop in it where it would loop through the array list, painting each rectangle object it encountered in the list. On your other ...

15. Large numbers of clickable rectangles on a JPanel    forums.oracle.com

Hey I'm building a map... on this map it should be possible to point a village As it is not a real-life map it is actually a JPanel with 900 rows and 1200 columns of villages (rectangles) There should be mouse interaction (mouseover, mouseout, mouseclicks) and at first I thought to do this with buttons Now it seems that this number ...