use of javax.swing.KeyStroke in project fql by CategoricalData.
the class OplDisplay method display.
// private final Map<String, String> indices = new HashMap<>();
private void display(String s, @SuppressWarnings("unused") List<String> order) {
frame = new JFrame();
// this.name = s;
Vector<String> ooo = new Vector<>();
// int index = 0;
for (Pair<String, JComponent> p : frames) {
x.add(p.second, p.first);
ooo.add(p.first);
// indices.put(order.get(index++), p.first);
}
x.add(new JPanel(), "blank");
cl.show(x, "blank");
yyy.setListData(ooo);
JPanel temp1 = new JPanel(new GridLayout(1, 1));
temp1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Select:"));
JScrollPane yyy1 = new JScrollPane(yyy);
temp1.add(yyy1);
// temp1.setMinimumSize(new Dimension(200, 600));
// yyy.setPreferredSize(new Dimension(200, 600));
yyy.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
yyy.addListSelectionListener((ListSelectionEvent e) -> {
int i = yyy.getSelectedIndex();
if (i == -1) {
cl.show(x, "blank");
} else {
cl.show(x, ooo.get(i));
}
});
JPanel north = new JPanel(new GridLayout(1, 1));
// JButton saveButton = new JButton("Save GUI");
// north.add(saveButton);
// saveButton.setMinimumSize(new Dimension(10,10));
// saveButton.addActionListener(x -> GUI.save2(env));
JSplitPane px = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
// px.setResizeWeight(.8);
px.setDividerLocation(200);
// FQLSplit px = new FQLSplit(.5, JSplitPane.HORIZONTAL_SPLIT);
px.setDividerSize(4);
frame = new JFrame(/* "Viewer for " + */
s);
JSplitPane temp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
temp2.setResizeWeight(1);
temp2.setDividerSize(0);
temp2.setBorder(BorderFactory.createEmptyBorder());
temp2.add(temp1);
temp2.add(north);
// px.add(temp1);
px.add(temp2);
px.add(x);
// JPanel bd = new JPanel(new BorderLayout());
// bd.add(px, BorderLayout.CENTER);
// bd.add(north, BorderLayout.NORTH);
// frame.setContentPane(bd);
frame.setContentPane(px);
frame.setSize(900, 600);
ActionListener escListener = (ActionEvent e) -> frame.dispose();
frame.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
frame.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
frame.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class FqlDisplay method display.
private void display(String s, List<String> order) {
frame = new JFrame();
name = s;
Vector<String> ooo = new Vector<>();
int index = 0;
for (Pair<String, JComponent> p : frames) {
x.add(p.second, p.first);
ooo.add(p.first);
indices.put(order.get(index++), p.first);
}
x.add(new JPanel(), "blank");
cl.show(x, "blank");
yyy.setListData(ooo);
JPanel temp1 = new JPanel(new GridLayout(1, 1));
temp1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Select:"));
JScrollPane yyy1 = new JScrollPane(yyy);
temp1.add(yyy1);
temp1.setMinimumSize(new Dimension(10, 10));
yyy.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
yyy.addListSelectionListener((ListSelectionEvent e) -> {
int i = yyy.getSelectedIndex();
if (i == -1) {
cl.show(x, "blank");
} else {
cl.show(x, ooo.get(i));
}
});
JPanel north = new JPanel(new GridLayout(2, 1));
JButton instanceFlowButton = new JButton("Instance Dependence Graph");
JButton schemaFlowButton = new JButton("Schema Mapping Graph");
instanceFlowButton.setMinimumSize(new Dimension(10, 10));
schemaFlowButton.setMinimumSize(new Dimension(10, 10));
north.add(instanceFlowButton);
instanceFlowButton.addActionListener((ActionEvent e) -> showInstanceFlow(prog));
north.add(schemaFlowButton);
schemaFlowButton.addActionListener((ActionEvent e) -> showSchemaFlow());
Split px = new Split(.5, JSplitPane.HORIZONTAL_SPLIT);
px.setDividerSize(6);
px.setDividerLocation(220);
frame = new JFrame(/* "Viewer for " + */
s);
JSplitPane temp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
temp2.setResizeWeight(1);
temp2.setDividerSize(0);
temp2.setBorder(BorderFactory.createEmptyBorder());
temp2.add(temp1);
temp2.add(north);
px.add(temp2);
px.add(x);
frame.setContentPane(px);
frame.setSize(900, 600);
ActionListener escListener = (ActionEvent e) -> frame.dispose();
frame.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
frame.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
frame.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class FqlDisplay method showSchemaFlow.
private void showSchemaFlow() {
JFrame f = new JFrame();
ActionListener escListener = (ActionEvent e) -> f.dispose();
f.getRootPane().registerKeyboardAction(escListener, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
KeyStroke ctrlW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK);
KeyStroke commandW = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK);
f.getRootPane().registerKeyboardAction(escListener, ctrlW, JComponent.WHEN_IN_FOCUSED_WINDOW);
f.getRootPane().registerKeyboardAction(escListener, commandW, JComponent.WHEN_IN_FOCUSED_WINDOW);
Graph<String, Object> g = prog.build2;
if (g.getVertexCount() == 0) {
f.add(new JPanel());
} else {
f.add(doView2(g));
}
f.setSize(600, 540);
f.setTitle("Schema Mapping Graph for " + name);
f.setLocationRelativeTo(null);
f.setVisible(true);
}
use of javax.swing.KeyStroke in project fql by CategoricalData.
the class FqlCodeEditor method doTemplates.
@Override
protected void doTemplates() {
CompletionProvider provider = createCompletionProvider();
AutoCompletion ac = new AutoCompletion(provider);
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
ac.setTriggerKey(key);
ac.install(topArea);
}
use of javax.swing.KeyStroke in project gitblit by gitblit.
the class EditUserDialog method createRootPane.
@Override
protected JRootPane createRootPane() {
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
JRootPane rootPane = new JRootPane();
rootPane.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
return rootPane;
}
Aggregations