Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1623 > unrolled thread
| Started by | "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:34 +0000 |
| Last post | 2011-04-27 15:35 +0000 |
| Articles | 8 — 2 participants |
Back to article view | Back to comp.lang.java.gui
Help: strange behaviour o "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: Help: strange behavio "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: Help: strange behavio "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: Help: strange behavio "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
Re: Help: strange behavio "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Help: strange behavio "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Help: strange behavio "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Help: strange behavio "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
| From | "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:34 +0000 |
| Subject | Help: strange behaviour o |
| Message-ID | <1179153409.346407.314310@p77g2000hsh.googlegroups.com> |
To: comp.lang.java.gui I have modal JFrame, in which I have JPanel which contains group of our own combo classes which extend JComboBox. When border of the frame is closer to lowest combo box, than border of combo box when it's open, combo box works fine. However, when I change height of JFrame so that its bottom border is further from combo box than border of lowest combo box when it's open, combo box starts behaving strangely. When I drag its scrollpad and move it up and down (to see items in Combo box), content moves ok, but scrollpad stays fixed on one place (instead of going up and down too). Would anybody have an idea why it doesn't work ? - there are 15 items in combo. - we use JDK 1.5.0_10 on WinXP --- * 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 | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:34 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <722b7d3f0943d@uwe> |
| In reply to | #1623 |
To: comp.lang.java.gui michal.sankot@gmail.com wrote: .. >Would anybody have an idea why it doesn't work ? I have an idea it is because of the code. -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/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 | "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:34 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <1180337413.370902.285350@m36g2000hse.googlegroups.com> |
| In reply to | #1625 |
To: comp.lang.java.gui Unfortunately your wit does not equal your helpfulness. Nonetheless, I've found out that this problem isn't related to our own components, but is present when standard Java components are used too. I suspect problem lies in using Glass Pane with inserted component to realise modal JInternalFrame implementation. Premises we have: - we need to implement modal window - we have to use JInternalFrame for modal window (can't use JDialog) Problem: Popup part of Combobox in JInternalFrame in GlassPane doesn't scroll. Remark: In code I had to set combobox.setLightWeightPopupEnabled(false), cause popup part of it wouldn't show otherwise. Code (3 files) in next post. --- * 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 | "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:34 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <1180337488.117760.127140@p47g2000hsd.googlegroups.com> |
| In reply to | #1719 |
To: comp.lang.java.gui
test\best\TestApp3.java
---------------------------------------
package test.best;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.UIManager;
public class TestApp3 {
public TestApp3() {
JFrame frame = new TestFrame3();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
new TestApp3();
}
}
test\best\TestFrame3.java
---------------------------------------
package test.best;
import cor.no.exception.CommonException;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class TestFrame3 extends JFrame {
private JComboBox jComboBox1 = new JComboBox(new String[]
{"Indicates","a","window","is","currently","the","active","window","Indicates","a","window","is","currently","the","active","window"});
private JLabel jLabel1 = new JLabel();
private JButton jButton1 = new JButton();
public TestFrame3() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout( null );
this.setSize(new Dimension(726, 458));
jComboBox1.setBounds(new Rectangle(200, 60, 140, 25));
jLabel1.setText("Back Combo");
jLabel1.setBounds(new Rectangle(45, 65, 110, 20));
jButton1.setText("Cover us with Glass");
jButton1.setBounds(new Rectangle(70, 125, 235, 30));
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
this.getContentPane().add(jButton1, null);
this.getContentPane().add(jLabel1, null);
this.getContentPane().add(jComboBox1, null);
}
private void jButton1_actionPerformed(ActionEvent e) {
JComponent glassPane = (JComponent)this.getGlassPane();
glassPane.setOpaque(true);
glassPane.setBackground(Color.RED); // so that you can see
that it's there
glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); //
so that you can see that it's there
glassPane.addMouseListener(new MouseAdapter(){}); // ignores
all mouse events
TestInternalFrame3 tif = null;
tif = new TestInternalFrame3();
tif.setParentGlassPane(glassPane); // so that we can get rid
of glass pane when internal frame is closed
tif.setPreferredSize(new Dimension(400,400));
tif.setLocation(0,100);
tif.setResizable(true);
tif.setVisible(true);
glassPane.add(tif);
glassPane.setVisible(true);
}
}
test\best\TestInternalFrame3.java
---------------------------------------
package test.best;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
public class TestInternalFrame3 extends JInternalFrame {
private JPanel jPanel1 = new JPanel();
private JComboBox jComboBox1 = new JComboBox(new String[]
{"The","glass","pane","is","useful","when","you","want","to","be","able","to","catch","events","or","paint","over","an","area","that","already","contains","one","or","more","components"});
private JButton jButton1 = new JButton();
private JComponent glassPane = null;
public TestInternalFrame3() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setTitle( "Test Internal Frame 3" );
jPanel1.setLayout(null);
jComboBox1.setBounds(new Rectangle(105, 90, 165, 25));
jComboBox1.setLightWeightPopupEnabled(false); // popup won't
show otherwise !!!!
jButton1.setText("Close modal window");
jButton1.setBounds(new Rectangle(140, 160, 88, 29));
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jPanel1.add(jButton1, null);
jPanel1.add(jComboBox1, null);
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
}
private void jButton1_actionPerformed(ActionEvent e) {
this.dispose();
this.glassPane.setVisible(false);
}
public void setParentGlassPane(JComponent glassPane){
this.glassPane = glassPane;
}
}
---
* 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:35 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <7308ce2393283@uwe> |
| In reply to | #1720 |
To: comp.lang.java.gui michal.sankot@gmail.com wrote: >test\best\TestApp3.java >--------------------------------------- >package test.best; OK.. that was more the code I was referring to in my first, obtuse, comment. After a couple of minor line-wrap fixes I got it to show on-screen, and display the odd errors in the second list (it seemed to become 'stuck in a loop' when scrolling values - I could not get to the bottom of the list values). I was not able to fix the problem. Just thought I should be plain about that before adding.. I am still not sure what this code is supposed to achieve, I made a number of changes to it, based on my pathological hatred of null layouts, I laid out the components (in .approximately the locations shown in your UI) added a JDesktopPane (JDP) [beneath the JInternalFrame (JIF)], .and was about to replace the JGlassPane (JGP), when I realised I was probably getting so far from your original intent that my changes were meaningless. And no.. none of my changes had solved the problem. I still think the problem is a combination of.. - lack of layouts. - use of a JIF in components other than JDP - use of the JGP (it is a tricky component) OTOH - I have little experience using JIF/JDP *or* JGP. Could you describe to me in words* what effect you are trying to achieve in this GUI? * Quite ironic, for somebody who is (in)famous for making calls to 'let the code do the talking'! -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/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:35 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <7308d59b6b14b@uwe> |
| In reply to | #1734 |
To: comp.lang.java.gui Andrew Thompson wrote: .. >...show >on-screen, and display the odd errors in the second list >(it seemed to become 'stuck in a loop' when scrolling >values - I could not get to the bottom of the list values). Using Java 1.6 - so no, it is not a plug-in version bug. It fails in both 1.5 & 1.6. -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/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 | "michal.sankot" <michal.sankot@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:35 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <1182154338.895707.310340@o61g2000hsh.googlegroups.com> |
| In reply to | #1737 |
To: comp.lang.java.gui What I wanted to achieve is to have modal window cerated using JInternalFrame (not JDialog, not JFrame). i.e. I want it to block events outiside of JInternalFrame and I want thread to wait until window is closed. While searching for a way how to do it, I've discovered that using JInternalFrame as a modal window is a long last issue, which has started as a bug in Sun's bug database in 1998 (!) <http:// bugs.sun.com/bugdatabase/view_bug.do?bug_id=4139692>. It still hasn't been solved. I've used Martin Bravenboer's code <https://svn.cs.uu.nl:12443/repos/ mbravenboer/java-lib/java/org/mbravenboer/gui/window/ JExtendedInternalFrame.java>, modified event handling and it does it ok. Thanks Michal --- * 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:35 +0000 |
| Subject | Re: Help: strange behavio |
| Message-ID | <73e06533c43f0@uwe> |
| In reply to | #1857 |
To: comp.lang.java.gui michal.sankot@gmail.com wrote: .. >While searching for a way how to do it, I've discovered that using >JInternalFrame as a modal window is a long last issue, .. .. >I've used Martin Bravenboer's code <https://svn.cs.uu.nl:12443/repos/ >mbravenboer/java-lib/java/org/mbravenboer/gui/window/ >JExtendedInternalFrame.java>, modified event handling and it does it >ok. Thanks for reporting back, especially with a solution. -- 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