Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2196 > unrolled thread

Is it possible to create

Started by"Daniel Gee" <daniel.gee@THRWHITE.remove-dii-this>
First post2011-04-27 15:37 +0000
Last post2011-04-27 15:37 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Is it possible to create "Daniel Gee" <daniel.gee@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
    Re: Is it possible to cre "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
      Re: Is it possible to cre "Daniel Gee" <daniel.gee@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000
    Re: Is it possible to cre "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:37 +0000

#2196 — Is it possible to create

From"Daniel Gee" <daniel.gee@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
SubjectIs it possible to create
Message-ID<1186379983.100849.4490@m37g2000prh.googlegroups.com>
  To: comp.lang.java.gui
I'm trying to make a JFrame application that emulates an 80 by 24
terminal with fixed width font (for displaying a Roguelike game). But
around the terminal part, I'd like to be able to place other
components as well (list of items held, etc). I'm not very experienced
with Swing and the best I've been able to manage is a JFrame that
isn't resizeable holding single JTextArea. If I make it so the JFrame
is of just the right size to fit 80 by 24 characters along with a
JMenuBar at the top, then things come out looking right.

The problem is, if I ever try to put any more components into the same
JFrame, I'm unable to control their size interacting with the
JTextArea. Or even, I can't get the JTextArea to stick to it's
preferred size if I make the JFrame resizeable and then expand it a
bit. I suspect this has to do with the LayoutManager, but I don't
really know much about them other than the basics of GridLayout and
BorderLayout. I tried using a SplitPane but they also seemed to use
relative positioning like everything else, which isn't much help.

Is what I'm after possible? Do I just need a different approach?

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#2197 — Re: Is it possible to cre

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
SubjectRe: Is it possible to cre
Message-ID<7646eccec5161@uwe>
In reply to#2196
  To: comp.lang.java.gui
Daniel Gee wrote:
..
>Is what I'm after possible? 

Yes.  Use layouts.
<http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html>

-- 
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200708/1

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2198 — Re: Is it possible to cre

From"Daniel Gee" <daniel.gee@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
SubjectRe: Is it possible to cre
Message-ID<1186387549.336024.39170@q3g2000prf.googlegroups.com>
In reply to#2197
  To: comp.lang.java.gui
Ah, I see. Of course, how simple. Heh. Of course the default layout
managers won't honor your requests at all and just do their own thing,
what could the programmer possibly know about the visual layout that
he _really_ wants?

Anyways,

** For readers who have this same question later and wonder what the
answer is: **
The trick is to use a BoxLayout, which will allow components to range
within the min and max sizes they specify, but won't force them
outside of that range like other layouts do.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2202 — Re: Is it possible to cre

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:37 +0000
SubjectRe: Is it possible to cre
Message-ID<f1meb3tcta7emduv37pa2pmbqjmeolkvns@4ax.com>
In reply to#2196
  To: comp.lang.java.gui
>Is what I'm after possible? Do I just need a different approach?
If you want a fixedSize component, see
http://mindprod.com/jgloss/getpreferredSize.html
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web