Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created February 24, 2014 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sciss/9188845 to your computer and use it in GitHub Desktop.
Save Sciss/9188845 to your computer and use it in GitHub Desktop.
Attempt to reproduce WebLaF issue #90 - doesn't reproduce the bug though....
package de.sciss.debug;
import com.alee.laf.WebLookAndFeel;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Debug implements Runnable {
public static void main(String[] args) {
WebLookAndFeel.install();
EventQueue.invokeLater(new Debug());
}
void openSucc(JDesktopPane parent) {
JInternalFrame i2 = new JInternalFrame("Succ") { };
final JLabel lb = new JLabel("Press Space Bar");
InputMap imap = lb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap amap = lb.getActionMap();
imap.put(KeyStroke.getKeyStroke(' '), "foobar");
amap.put("foobar", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
lb.setText("Okay!");
}
});
i2.getContentPane().add(lb);
parent.add(i2);
i2.setBounds(200, 200, 200, 200);
i2.setVisible(true);
}
public void run() {
JFrame f = new JFrame("Main") { };
f.setSize(412, 480);
JInternalFrame i1 = new JInternalFrame("Pred") { };
JButton b = new JButton("Test") { };
final JDesktopPane desk = new JDesktopPane() { };
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
openSucc(desk);
}
});
i1.getContentPane().add(b);
i1.setSize(200, 200);
i1.setVisible(true);
f.getContentPane().add(desk);
desk.add(i1);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment