Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2006

Tip: Looking for answers? Try searching our database.

Problem with JRE1.5 Swing on Ratpoison

Thread view: 
cklee1967@gmail.com - 15 Jan 2006 08:05 GMT
I have a Java Swing app written in JDK1.3.1 with runs under X windows
using the Ratpoison window manager.  But when I tried running the same
app using JRE1.5.0 under Ratpoison, the text and all the
components/widget are missing (only the Frame shows).
I have tried using the same JRE and app under IceWM window manager and
it works.
Any ideas why ?

CK
Roedy Green - 15 Jan 2006 09:17 GMT
>I have a Java Swing app written in JDK1.3.1 with runs under X windows
>using the Ratpoison window manager.  But when I tried running the same
[quoted text clipped - 3 lines]
>it works.
>Any ideas why ?

What a strange name, Ratpoison. Have you another to try?

Can you post a small piece of code that exhibits this problem?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

cklee1967@gmail.com - 16 Jan 2006 03:23 GMT
> What a strange name, Ratpoison. Have you another to try?

Ratpoison is a minimalist Window Manager for Linux. It does not need a
mouse and
can move away the Mouse pointer.

> Can you post a small piece of code that exhibits this problem?

import javax.swing.*;

public class RatpoisonTest extends JFrame {

   /** Creates a new instance of RatpoisonTest */
   public RatpoisonTest() {
       JLabel l = new JLabel("Hello World");
       this.getContentPane().add(l);
       this.setSize(400, 400);
       // Uncomment the following to make it show in Ratpoison
       //this.pack();
       this.setVisible(true);
   }

   public static void main(String args[]) {
       RatpoisonTest r = new RatpoisonTest();
   }
}

CK
Thomas Hawtin - 16 Jan 2006 16:42 GMT
> import javax.swing.*;

Does it still happen if you use AWT instead of Swing?

> public class RatpoisonTest extends JFrame {

Personal hate: There is no need to extend JFrame here.

>     /** Creates a new instance of RatpoisonTest */
>     public RatpoisonTest() {
[quoted text clipped - 4 lines]
>         //this.pack();
>         this.setVisible(true);

Have you tried frame.validate(); after the setVisible? Or perhaps
frame.addNotify(); before the setVisible. setVisible should validate the
window, but does so between adding the peer (addNotify) and actually
showing the window. I wonder if RatPoison is doing something nasty if
the window is created but not visible.

>     }
>
>     public static void main(String args[]) {

This should have the standard boilerplate.

          java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
>         RatpoisonTest r = new RatpoisonTest();
                  }
          });

Even if you are not using Swing, AWT is full of threading bugs.

>     }
> }

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

cklee1967@gmail.com - 29 Jan 2006 08:30 GMT
Ok, I have tried the Shift-Ctrl-F1 it dumps the following:

a[frame0,0,0,400x400,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,5,25,390x370,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

javax.swing.JRootPane[,5,25,390x370,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=]

javax.swing.JPanel[null.glassPane,0,0,390x370,hidden,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777217,maximumSize=,minimumSize=,preferredSize=]

javax.swing.JLayeredPane[null.layeredPane,0,0,390x370,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,optimizedDrawingPossible=true]

javax.swing.JPanel[null.contentPane,0,0,390x370,layout=javax.swing.JRootPane$1,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]

javax.swing.JLabel[,0,0,390x370,alignmentX=0.0,alignmentY=0.0,border=,flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,horizontalAlignment=LEADING,horizontalTextPosition=TRAILING,iconTextGap=4,labelFor=,text=Hello
World,verticalAlignment=CENTER,verticalTextPosition=CENTER]

Then, I tried the export AWT_TOOLKIT=MToolkit  and it works !  Thanks
Tom.
I have not tried it in AWT (rather not rewite the whole app)
and all the recoding tricks (validate(), addNotify, eventQueue) didn't
work.

CK
Thomas Hawtin - 15 Jan 2006 16:40 GMT
> I have a Java Swing app written in JDK1.3.1 with runs under X windows
> using the Ratpoison window manager.  But when I tried running the same
> app using JRE1.5.0 under Ratpoison, the text and all the
> components/widget are missing (only the Frame shows).
> I have tried using the same JRE and app under IceWM window manager and
> it works.

Do other Swings apps work? Does it generate any exceptions? If you do
Shift-Ctrl-F1 (assuming that isn't intercepted) are the components
present and correct?

It might be worth switching to the old Motif toolkit and seeing if that
works. In bash:

export AWT_TOOLKIT=MToolkit

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Knute Johnson - 15 Jan 2006 18:23 GMT
> Do other Swings apps work? Does it generate any exceptions? If you do
> Shift-Ctrl-F1 (assuming that isn't intercepted) are the components
> present and correct?

> Tom Hawtin

What does Shift-CTRL-F1 do?

Thanks,

Signature

Knute Johnson
email s/nospam/knute/

Thomas Hawtin - 15 Jan 2006 19:21 GMT
>> Do other Swings apps work? Does it generate any exceptions? If you do
>> Shift-Ctrl-F1 (assuming that isn't intercepted) are the components
>> present and correct?
>
> What does Shift-CTRL-F1 do?

From java.awt.Window.preProcessKeyEvent

     * Implements a debugging hook -- checks to see if
     * the user has typed <i>control-shift-F1</i>.  If so,
     * the list of child windows is dumped to <code>System.out</code>.

That's slightly incorrect. It dumps itself and child components
recursively. It does not dump owned windows at all.

It should print something like this (in this example, an empty applet
"AppletParents" of size 100x100).

sun.applet.AppletViewer[frame0,0,0,110x175,invalid,layout=java.awt.Borde
rLayout,title=Applet Viewer: AppletParents.class,resizable,normal]]
 sun.applet.AppletViewerPanel[panel0,5,49,100x100,invalid,layout=java.aw
t.BorderLayout]
  AppletParents[panel1,0,0,100x100,layout=java.awt.FlowLayout]
 java.awt.Label[label0,5,149,100x21,invalid,align=left,text=Applet start
ed.]

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Knute Johnson - 15 Jan 2006 21:50 GMT
>>> Do other Swings apps work? Does it generate any exceptions? If you do
>>> Shift-Ctrl-F1 (assuming that isn't intercepted) are the components
[quoted text clipped - 23 lines]
>
> Tom Hawtin

Thanks Tom,

Signature

Knute Johnson
email s/nospam/knute/

cklee1967@gmail.com - 16 Jan 2006 03:25 GMT
Other swing apps work ... seems to depend on how you code the screen.

There is no exception on the console.

I have not tried the Shift-Ctrl-F1 yet or the export AWT_TOOLKIT.

I have tested with JRE1.3.1 and JRE1.4.2 and the app works (i.e. screen
shows up) but not on JRE1.5.0

CK
Richard Wheeldon - 15 Jan 2006 20:08 GMT
> I have a Java Swing app written in JDK1.3.1 with runs under X windows
> using the Ratpoison window manager.  But when I tried running the same
> app using JRE1.5.0 under Ratpoison, the text and all the
> components/widget are missing (only the Frame shows).
> Any ideas why ?

I've not noticed this particular problem but I have noticed two other
issues with using ratpoison. Firstly, moving toolbars doesn't work -
they just expand to fill the screen and stop anything else from being
visible. Secondly, drop down menus in combo boxes will not appear beyond
the area of a containing dialog. I don't know if there's any
relationship between these problems and yours,

Richard
hiwa - 16 Jan 2006 05:51 GMT
See: http://java.sun.com/j2se/1.5.0/system-configurations.html
I suspect the window manager compliance issue with standards
such as ICCCM, EWMH etc. ...
hiwa - 16 Jan 2006 06:05 GMT
Also, see: http://www.freedesktop.org/wiki/Standards_2fwm_2dspec


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.