Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2578 > unrolled thread
| Started by | "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:39 +0000 |
| Last post | 2011-04-27 15:40 +0000 |
| Articles | 11 — 5 participants |
Back to article view | Back to comp.lang.java.gui
Unpredictable Swing behav "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
Re: Unpredictable Swing b "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
Re: Unpredictable Swing b "Nigel Wade" <nigel.wade@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
Re: Unpredictable Swing b "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
Re: Unpredictable Swing b "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
| From | "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Subject | Unpredictable Swing behav |
| Message-ID | <4703B048.2C8B@softhome.net> |
To: comp.lang.java.gui I have built an application based on JFrame and a BorderLayout with some added components. I have some very real problems with controlling how it behaves. Components are not necessarily shown until I resize the window. How do I solve that? I assume that it is some basic Swing methodology that I don't know. You may run the application from http://cafka.econ.au.dk/launcher.jnlp . Thanks in advance. Hokan Lane --- * 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]
| From | "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <4703ba8a$0$8422$db0fefd9@news.zen.co.uk> |
| In reply to | #2578 |
To: comp.lang.java.gui Hokan Lane wrote: > I have built an application based on JFrame and a BorderLayout with > some added components. I have some very real problems with controlling > how it behaves. Components are not necessarily shown until I resize the > window. How do I solve that? I assume that it is some basic Swing > methodology that I don't know. You may run the application from > http://cafka.econ.au.dk/launcher.jnlp . Thanks in advance. HTTP Status 404 - /launcher.jnlp type Status report message /launcher.jnlp description The requested resource (/launcher.jnlp) is not available. Apache Tomcat/5.5.20 Posting an SSCCE* here might work better. * http://mindprod.com/jgloss/sscce.html http://homepage1.nifty.com/algafield/sscce.html --- * 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]
| From | "Nigel Wade" <nigel.wade@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:39 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <fe0ec6$loq$1@south.jnrs.ja.net> |
| In reply to | #2578 |
To: comp.lang.java.gui
Hokan Lane wrote:
> I have built an application based on JFrame and a BorderLayout with
> some added components. I have some very real problems with controlling
> how it behaves. Components are not necessarily shown until I resize the
> window. How do I solve that? I assume that it is some basic Swing
> methodology that I don't know. You may run the application from
> http://cafka.econ.au.dk/launcher.jnlp . Thanks in advance.
>
> H|Nkan Lane
The usual reason for this is not following the rules on concurrency in Swing.
All modifications to the GUI should be performed on the event dispatch thread
(EDT). If you don't follow this rule then the EDT (which is responsible for
maintaining the view of the GUI) doesn't know that you've changed some aspect
of it and that it needs to be redrawn (gross oversimplification on my part).
Have a look at the Java Tutorial on Swing,
http://java.sun.com/docs/books/tutorial/uiswing/index.html,
especially the section on Concurrency in Swing.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
---
* 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]
| From | "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <cjk8g35vl56aefquso1dl78kov6qja1lcb@4ax.com> |
| In reply to | #2578 |
To: comp.lang.java.gui On Wed, 03 Oct 2007 17:07:52 +0200, Hokan Lane <H.L@softhome.net> wrote, quoted or indirectly quoted someone who said : >I have built an application based on JFrame and a BorderLayout with >some added components. I have some very real problems with controlling >how it behaves. Components are not necessarily shown until I resize the >window. How do I solve that? I assume that it is some basic Swing >methodology that I don't know. You may run the application from >http://cafka.econ.au.dk/launcher.jnlp . Thanks in advance. For background, read http://mindprod.com/jgloss/validate.html and http://mindprod.com/jgloss/swingthreads.html and chase links. -- 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] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <792f9ea90bd1c@uwe> |
| In reply to | #2578 |
To: comp.lang.java.gui H|Nkan Lane wrote: >I have built an application based on JFrame and a BorderLayout with >some added components. I have some very real problems with controlling >how it behaves. Components are not necessarily shown until I resize the >window. How do I solve that? There were some other good suggestions (especially the SSCCE,) but I suspect a pack() or validate() at the end of the initial widget construction and placement, will solve this problem. >..I assume that it is some basic Swing >methodology that I don't know. If I am correct, the same problem can also affect AWT. -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200710/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]
| From | "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <47060CE6.671A@operamail.com> |
| In reply to | #2593 |
To: comp.lang.java.gui Thanks a lot for all your posts. First of all, the address should be http://cafka.econ.au.dk/LMDG_Doc/launcher.jnlp and nothing else. I apologise for the mistake. The problem was solved by calling pack at the end for my subclass of JFrame holding the contents presented to the user. The problem of components not showing upon program start was thus avoided, but I have now reached a problem where a part of the layout (box with some buttons in the bottom row) does not show up when I close a "pop up" window. Can this thing be mitigated with the same type of commands? I supppose that I need to understand your points about concurrency to fully know how to deal with these nuisances. Hokan Lane Andrew Thompson wrote: > > H|Nkan Lane wrote: > >I have built an application based on JFrame and a BorderLayout with > >some added components. I have some very real problems with controlling > >how it behaves. Components are not necessarily shown until I resize the > >window. How do I solve that? > > There were some other good suggestions (especially the > SSCCE,) but I suspect a pack() or validate() at the end of > the initial widget construction and placement, will solve > this problem. > > >..I assume that it is some basic Swing > >methodology that I don't know. > > If I am correct, the same problem can also affect AWT. > > -- > Andrew Thompson > http://www.athompson.info/andrew/ > > Message posted via JavaKB.com > http://www.javakb.com/Uwe/Forums.aspx/java-gui/200710/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]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <793bc65f2633c@uwe> |
| In reply to | #2596 |
To: comp.lang.java.gui
H|Nkan Lane wrote:
>Thanks a lot for all your posts.
Your thanks, for my post at least, can be best expressed
by posting your replies in-line, with trimming, as I am doing,
rather than by 'top-posting'. I find that most confusing.
>..First of all, the address should be
>http://cafka.econ.au.dk/LMDG_Doc/launcher.jnlp and nothing else.
That's better, at least in the fact it is a valid URL!
It is, unfortunately, entirely invalid. It may work, but
probably not reliably.
Here is what I recommend replacing it with..
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP file for Cafkadoc app. -->
<jnlp
spec="1.0+"
codebase="http://cafka.econ.au.dk/LMDG_Doc/"
>
<information>
<title>Cafkadoc Java Application</title>
<vendor>CLS</vendor>
<homepage href="/var/sioux/docs/index.html"/>
<description>Cafka documentation application</description>
<description kind="short">
Application for documentation about the DLS projects
</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="Cafkadoc.jar"/>
</resources>
<application-desc />
</jnlp>
This one places the application-desc after the resources, where
it should be, and makes a number of other minor tweaks
(including the comment re SwingSet2!). The only actual
difference is that I changed it from 1.5 to 1.5+, to account
for my 1.6 based box (why go back to 1.5 now!).
Why is it 'full-permissions'?*
I downloaded the JNLP, and the jar to a local directory,
changed the JNLP to 'sandboxed' and ran it from there.
Got to see the GUI, and even the Info page in a JEditorPane(?)
"Labor Research Group
School of Economics and Management -
University of Aarhus"
There is an 'interesting problem' with that window.
I noted that when I dragged the main window left/right,
it obscured a 'proportional degree' of the HTML(?)
window - and I mean an area entirely beyond the main
app.'s boundaries!
Are you using null layouts, exact positioning,
doing clever things with content or glasspanes..?
* Because the (now sandboxed) app. tried to get the
location of user.home, Java kindly offered to shut it
down for me, but interestingly, I could just send that
dialog to the back and keep poking around in the app.!
>The problem was solved by calling pack at the end for my subclass of
>JFrame holding the contents presented to the user.
Glad it is sorted.
> ... I have
>now reached a problem where a part of the layout (box with some buttons
>in the bottom row) does not show up when I close a "pop up" window.
What pop-up window? Besides the problem mentioned
above, I did not see any rows of buttons at bottom of
anything. Is it in one of the 'secure areas' of the program?
(I am not willing to run 'jar's from folks on the net in anything
other than a sandbox - unless I know them well, and trust
both their integrity and competence.)
>..Can
>this thing be mitigated with the same type of commands?
No. I am not sure about the rows of buttons, it sounds
suspiciuosly related to the gray window, and I think *that*
has to do with use of the null layouts and other things
mentioned earlier.
>I supppose that I need to understand your points about concurrency
I did not make any, though I expect others in this
thread, did. I do not think that is the immediate
source of the problem I saw.
But to bring you back to the very first suggestion on
the thread, can you supply an SSCCE of this behaviour?
Being a GUI problem, it should be able to display
the effect without reaching outside the sandbox.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200710/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]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <793be462af245@uwe> |
| In reply to | #2597 |
To: comp.lang.java.gui Andrew Thompson wrote: .. >* Because the (now sandboxed) app. tried to get the >location of user.home, ... Or rather.. #### access denied (java.util.PropertyPermission user.dir read) .(I knew it was 'user.something'). What is the apps. interest in the current directory? Note that a variety of things you might normally do in a signed and trusted JWS app., can also be achieved in a sandboxed app. Check the possibilites here. <http://www.physci.org/jws/#api> -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200710/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]
| From | "Håkan Lane" <håkan.lane@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <470A95E4.2DCA@operamail.com> |
| In reply to | #2598 |
To: comp.lang.java.gui Let me try to answer your points. - This is the first Java Swing application that I am working on. It is a relatively small thing for the local division and it works well for our purposes so far. I have found the JNLP page from a web source. We have no interest in trying too much extravagant stuff. I don't need all your comments about sandboxed stuff et. c. and things being "entirely invalid" on this type of program. This is probably why you don't see the buttons as well. Perhaps I will learn more as time goes on. - The reason why it asks for the user directory at one point is because I read files from that directory when testing a feature. It probably should not be in the code anymore. Thank you for this observation. - I have used BorderLayouts for most of the frames. The JEditorPane is just called with the constructor and the url of the displayed page as the argument. I did not apply a Layoutmanager for that window. Regards, Hokan Lane Andrew Thompson wrote: > > Andrew Thompson wrote: > .. > >* Because the (now sandboxed) app. tried to get the > >location of user.home, ... > > Or rather.. > #### access denied (java.util.PropertyPermission user.dir read) > .(I knew it was 'user.something'). > > What is the apps. interest in the current directory? > > Note that a variety of things you might normally do in > a signed and trusted JWS app., can also be achieved > in a sandboxed app. Check the possibilites here. > <http://www.physci.org/jws/#api> > > -- > Andrew Thompson > http://www.athompson.info/andrew/ > > Message posted via JavaKB.com > http://www.javakb.com/Uwe/Forums.aspx/java-gui/200710/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]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <796df14b29651@uwe> |
| In reply to | #2607 |
To: comp.lang.java.gui
H|Nkan Lane wrote:
..
>- The reason why it asks for the user directory at one point is because
>I read files from that directory when testing a feature. It probably
>should not be in the code anymore.
OK, but if you decide different, note that you can point
a javax.jnlp.FileOpenService to the current directory by
feeding it a path hint of ".". Using JNLP services for
things like that, would allow this application to be
offered in a 'sandboxed' form.
>...Thank you for this observation.
You are welcome. I have an interest in looking into
JWS apps. in general, to get a sense for how close
they come to being fully 'sandbox'able.
>- I have used BorderLayouts for most of the frames. The JEditorPane is
>just called with the constructor and the url of the displayed page as
>the argument. I did not apply a Layoutmanager for that window.
A JWindow? Please try to be specific*, so we are all
sure we are 'on the same page'. A quick test** in Java
6 suggests the default layout for JWindow is BorderLayout
as well.
Without specifying a layout constraint for an added
Component, the default is BorderLayout.CENTER.
That is the window showing the Uni. site we are
referring too, right?
* Hey! You know what I was saying about 'specific'?
Now I recheck it I realise that is specifically *not*
a JWindow - looks like a JFrame, am I right? OK -
all the above is same for JFrame**, but please
refrain from using generic terms like 'window'.
Now - I still don't think I have quite managed to
communicate what I am seeing, but since 'a picture
paints a thousand words', I'll give you 'two thousand'..
<http://www.physci.org/test/screenshot/kafka-1-16.png>
<http://www.physci.org/test/screenshot/kafka-2-16.png>
Besides the odd problem of the web page appearing
and disappearing according to the width of stretched
main JFrame, the JTables of the JFrame could use
adjusting. Those JTables could do with stretching
left to right as the JFrame increases width. I
suspect they went into the WEST of one of the
BorderLayouts?
** Little example
<sscce>
import java.awt.*;
import javax.swing.*;
class DefaultLayoutManager {
static String[] constraint =
{
BorderLayout.NORTH,
BorderLayout.EAST,
BorderLayout.WEST,
BorderLayout.SOUTH,
BorderLayout.CENTER
};
public static void main(String[] args) {
JFrame root = new JFrame();
System.out.println( root.getLayout() );
for (int ii=0; ii<constraint.length; ii++ ) {
root.add(
new JButton(constraint[ii]),
constraint[ii] );
}
//check where the component goes, by default
root.add(new JLabel("Default") );
root.pack();
root.setVisible(true);
}
}
</sscce>
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200710/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]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:40 +0000 |
| Subject | Re: Unpredictable Swing b |
| Message-ID | <796e011677f9b@uwe> |
| In reply to | #2610 |
To: comp.lang.java.gui Andrew Thompson wrote: >... .. >Now - I still don't think I have quite managed to >communicate what I am seeing, but since 'a picture >paints a thousand words', I'll give you 'two thousand'.. ><http://www.physci.org/test/screenshot/kafka-1-16.png> ><http://www.physci.org/test/screenshot/kafka-2-16.png> BTW - reduced the palette to 16 colors to drop the image sizes by a factor of three. The colors are 'a bit off', but also not the point. -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via http://www.javakb.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