Hi! I noticed the following problems in recent releases of Linux jdk 1.1.6. RedHat 5.0 glibc version of jdk, no dynamic Motif Window Manager: fvwm2, icewm (http://ixtas.fri.uni-lj.si/~markom/icewm/) Port#1: java version "Linux_JDK_1.1.6_v1" Port#2: java version "[EMAIL PROTECTED]:05/29/98-18:52" (RH5.0_jdk1.1.6v1.2) The first program (noresize.java) has two testcases. The first one involves toggling setResizable. The second one moves the window 1 pixel to the right/bottom. Problem #1: Window jumps upwards for ~titlebar size the first time Move+1+1 button is pressed. It works fine afterwards. This is repeatable both with fvwm2 and icewm. (I also tried wmaker, but oddly enough the window moves in the wrong direction there -- it seems to be wmaker bug). Repeatable under Port#1 and Port#2 Problem #2: setResixable(false) disables minimize function too. It probably should not do that. Repeatable under Port#1 and Port#2 Problem #3: toggling setResizable(...) repeatedly maps and unmaps the window. This is very ugly and probably unnecessary. It should be enough just to update the MWM and other hints. Mapping/unmapping the frame also loses all the WM state and this is bad. There is also a possible (?) bug in mapping/unmapping the window. Previous versions of icewm had a problem where window would not come up again. This was caused by the fact that window was reparented back to the root and the map request was sent (before even reparented) to the parent frame (now destroyed). Since icewm is more OO than other WMs this caused the map request being ignored. I have made a workaround for this, but I'd prefer to remove it someday. Repeatable under Port#1 and Port#2 Problem #4: application that sets setResizable(false) has the default size wrong (min/max sizes are OK). Here is the output of xprop: program specified size: 513 by 291 program specified minimum size: 512 by 291 program specified maximum size: 512 by 291 A cutdown testcase is offone.java (It needs swing). Output of xprop for it is: program specified size: 101 by 135 program specified minimum size: 100 by 135 program specified maximum size: 100 by 135 The min,max sizes look correct but the default size is not within the limits. Repeatable under Port#2. It also occured in some previous versions of Port#1, but seems to be OK now. Mark -- ... ClickToFocus forever! :-) --------_-------------------------------------------------------------- [EMAIL PROTECTED] http://ixtas.fri.uni-lj.si/~markom/
import java.awt.*; import java.awt.event.*; public class noresize extends Frame implements WindowListener, ActionListener{ Button toggleResizable, move; public void windowOpened(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} public void windowActivated(WindowEvent e) {} public void windowClosing(WindowEvent e) { System.exit(0); } public void actionPerformed(ActionEvent e) { if (e.getSource() == toggleResizable) { setResizable(!isResizable()); } else if (e.getSource() == move) { setLocation(getLocation().x + 1, getLocation().y + 1); } } public noresize() { super(); addWindowListener(this); setSize(300,200); //setLocation(100, 100); setLayout(new FlowLayout()); toggleResizable = new Button ("Toggle Non-Resizable"); toggleResizable.addActionListener(this); add(toggleResizable); move = new Button("Move +1+1"); move.addActionListener(this); add(move); setVisible(true); } public static void main(String[] args) { new noresize(); } }
import java.awt.*; import java.awt.event.*; import com.sun.java.swing.*; public class offone extends JComponent { JFrame frame; JLabel scoreLabel; offone(JFrame f, JLabel s) { super(); frame = f; scoreLabel = s; setSize(100, 100); setBackground(Color.black); } public Dimension getMinimumSize() { return new Dimension(100, 100); } public Dimension getMaximumSize() { return getMinimumSize(); } public Dimension getPreferredSize() { return getMinimumSize(); } public void paint(Graphics g) { g.setColor(Color.blue); g.fillRect(0, 0, 100, 100); } public static void main(String[] args) { GridBagLayout grid = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); JFrame frame = new JFrame("offone"); JPanel panel = new JPanel(grid); panel.setOpaque(true); panel.setBackground(Color.lightGray); c.fill = c.BOTH; c.anchor = c.NORTH; JLabel score = new JLabel("0"); score.setHorizontalAlignment(score.CENTER); score.setOpaque(true); c.weightx = 1.0; c.gridwidth = c.REMAINDER; grid.setConstraints(score, c); panel.add(score); offone g = new offone(frame, score); c.anchor = c.CENTER; c.weightx = 0.0; grid.setConstraints(g, c); panel.add(g); JMenuBar menubar = new JMenuBar(); JMenu m; JMenuItem i; m = new JMenu("Game"); m.setMnemonic('G'); i = new JMenuItem("Quit"); i.setMnemonic('Q'); i.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_MASK)); m.add(i); menubar.add(m); frame.setJMenuBar(menubar); frame.getContentPane().add(panel); frame.getContentPane().setBackground(Color.lightGray); frame.pack(); frame.show(); frame.setResizable(false); frame.addWindowListener(new AppCloser()); } protected static final class AppCloser extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(0); } } }