Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Advice on how to implement this GUI ?  RSS feed

 
Albert Kam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

My name is albert kam .. I hope you could give me pointers about these matters.

I need gui components that is also available in these screenshots of partition magic 8.

At screenshot 2, where there are 3 partitions. If i were to
- right click one of the partition, and choose resize,
- i can resize the partition from the partition boxes by hovering it,
- and the cursor changes into left and right arrow,
- and then i can drag to the left or right, and then release.

What's the better way to do this in Java GUI ?
My imagination says to use JLabel for this, where i could implement own's coloring by playing with it's Graphics2D.

Also, i could add the right click popup listener.

But to be dragable to left and right, and to change the cursor while hovering the edge of the partition box, how do i achieve that ?

Please advice ..

Regards,
Albert Kam
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what the JSplitPane class does.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an idea:
 
Albert Kam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all !

I was told to use a split pane too, but i assumed that split pane only split into 2, and in the screenshots there are several partitions .. But i'll take a look into this component as i'm not familiar with it yet. Thanks !

I've tried running the code, it runs great after editing it to become f.getContentPane().add(xxx). I'll study this code as soon as i get home ! Thank you !

Regards,
Albert Kam
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, split panes always have two components. If your GUI has more than two panes, you'd create a hierarchy of panes, in other words, a toplevel split pane that contains two JPanels that contain second-level split panes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!