• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CSS follows box model, what is Swing UI's Equivalent?

 
Ranch Hand
Posts: 68
1
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What structure?
 
Saloon Keeper
Posts: 10805
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When used correctly it embodies MVC - Model View Controller.
 
Swapnil Mishra
Ranch Hand
Posts: 68
1
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:When used correctly it embodies MVC - Model View Controller.



No, MVC is an architecture.

I am asking how are components layered upon each other ? or how should they be?

Frame contains > panels contains > other components > ....etc
 
Carey Brown
Saloon Keeper
Posts: 10805
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
 
Marshal
Posts: 4541
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

In of title for this thread, Swapnil Mishra wrote:CSS follows box model, what is Swing UI's Equivalent?


Take a look at the Layout Managers and see which one(s) would best satisfy your needs.

I haven't used Swing in a while, but I have used these before for box type layouts::
   - BoxLayout
   - GridLayout
   - GridBagLayout
 
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe this Java™ Tutorials section will help.
 
Saloon Keeper
Posts: 27885
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Both Swing and CSS are based on the premise that areas of interest are laid out in rectangular areas, where some rectangular areas may also serve as containers for other rectangular areas. I don't use the word "rectangle" because while a given component is always contained within a bounding rectangle, there are times where the area of interest/rendered area may not itself be a rectangle. And also note that in some cases, "area of interest" may differ from "rendered area", such as when a rectangular area contains, say, a map of the continental United States, but you can click on sub-rectangles or aggregates of sub-rectangles to indicate a particular state.

The default layout for CSS is simple box packing, but you can also have stuff like floating and relative DIVs. Swing, on the other hand, offers a number of layout algorithms which can be selected at both top and containing component levels. The two display sysstems are more alike than they are different and for the most part, you can get the same layouts from either, though it might be a bit kludgier to do so using CSS.

Of course, as Carey pointed out, Swing is a complete GUI framework, based on MVC whereas CSS is View-only and requires additional frameworks to attend to the Model and Controller aspects.
 
Swapnil Mishra
Ranch Hand
Posts: 68
1
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Maybe this Java™ Tutorials section will help.


Very Helpful
 
Saloon Keeper
Posts: 7601
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


   - BoxLayout
   - GridLayout
   - GridBagLayout


Some 3rd party layouts are quite useful. Check out GridLayout2 and SGLayout.
 
reply
    Bookmark Topic Watch Topic
  • New Topic