Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 830825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:06:26+00:00 2026-05-15T04:06:26+00:00

first of all, this is more or less my first GUI and ive learned

  • 0

first of all, this is more or less my first GUI and ive learned Java for not more then a week, so it might contain some serious programming errors.

What i have right now is:
Buttons and labels are part of OptionPanel and are on the left, DrawingPanel is about 5×5 px in size and is on the right.

What I am trying to do is a simple test, to get me more familiar with the GUI. The rectangle should be movable and re-sizeable by the user when clicking the respective buttons:
http://www.upload.ee/image/612005/JFrame2.jpg

Right now i have:

JFrame MainFrame – Makes JFrame (Not using the setSize function. using .pack() instead. not sure about it)

JPanel MergedPanel – FlowLayout – Adds JPanel OptionsPanel and JPanel DrawingPanel together and gets injected to JFrame MainFrame

JPanel DrawPanel – This JPanel is responsible of drawing the rectangle.
JPanel OptionPanel – FlowLayout – This JPanel is responsible of the buttons.

Help please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:06:27+00:00Added an answer on May 15, 2026 at 4:06 am

    You should never call setSize() in your code. In Java, you use layout managers to do the layout (read that tutorial).

    Subclassing JPanel to implement different parts of which the UI is composed is a good practice, but should not be overdone (it’s fine to have an UI class that adds 3 other plain JPanel instances to itself for layout purposes).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more or less my first java project. I can't get my while
First of all, pardon me for bringing up this hugely discussed issue once more
first of all: this is not the same as this . The ModelBackend has
First of all: This question is not directly programming related. However, the problem only
First of all I'm not sure this is even possible, however I need to
So this is my first time posting here but I'm more or less stumped.
First of all, this will not be a post about Database Transactions. I want
First of all, this is not about making the PictureBox control transparent. It's about
First of all this is my markup: <div class=first></div> <div class=second></div> <div class=second></div> <div
first of all this is my third question about web services here and i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.