use of javax.swing.event.TreeSelectionListener in project JWildfire by thargor6.
the class TinaInternalFrame method getGradientLibTree.
private JTree getGradientLibTree() {
if (gradientLibTree == null) {
gradientLibTree = new JTree();
gradientLibTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
if (tinaController != null) {
tinaController.getGradientController().gradientTree_changed(e);
}
}
});
}
return gradientLibTree;
}
use of javax.swing.event.TreeSelectionListener in project JWildfire by thargor6.
the class TinaInternalFrame method getScriptPanel.
/**
* This method initializes scriptPanel
*
* @return javax.swing.JPanel
*/
private JPanel getScriptPanel() {
if (scriptPanel == null) {
scriptPanel = new JPanel();
scriptPanel.setLayout(new BorderLayout(0, 0));
JPanel panel_1 = new JPanel();
panel_1.setMaximumSize(new Dimension(32767, 172));
panel_1.setPreferredSize(new Dimension(210, 220));
scriptPanel.add(panel_1, BorderLayout.NORTH);
panel_1.setLayout(new BorderLayout(0, 0));
JPanel panel_2 = new JPanel();
panel_2.setPreferredSize(new Dimension(124, 10));
panel_1.add(panel_2, BorderLayout.EAST);
panel_2.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 1));
rescanScriptsBtn = new JButton();
rescanScriptsBtn.setMinimumSize(new Dimension(116, 12));
rescanScriptsBtn.setMaximumSize(new Dimension(116, 12));
rescanScriptsBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tinaController.getJwfScriptController().rescanBtn_clicked();
}
});
panel_2.add(rescanScriptsBtn);
rescanScriptsBtn.setToolTipText("Rescan script-folder");
rescanScriptsBtn.setText("Rescan");
rescanScriptsBtn.setPreferredSize(new Dimension(116, 24));
rescanScriptsBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
rescanScriptsBtn.setBounds(new Rectangle(9, 280, 125, 24));
JPanel panel_8 = new JPanel();
panel_8.setPreferredSize(new Dimension(116, 4));
panel_8.setMinimumSize(new Dimension(116, 8));
panel_8.setMaximumSize(new Dimension(32767, 8));
panel_2.add(panel_8);
panel_2.add(getNewScriptBtn());
panel_2.add(getDuplicateScriptBtn());
panel_2.add(getNewScriptFromFlameBtn());
deleteScriptBtn = new JButton();
deleteScriptBtn.setMinimumSize(new Dimension(58, 12));
deleteScriptBtn.setMaximumSize(new Dimension(58, 12));
deleteScriptBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tinaController.getJwfScriptController().deleteScriptBtn_clicked();
}
});
deleteScriptBtn.setToolTipText("Delete script");
deleteScriptBtn.setText("Del");
deleteScriptBtn.setPreferredSize(new Dimension(58, 24));
deleteScriptBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
deleteScriptBtn.setBounds(new Rectangle(9, 280, 125, 24));
panel_2.add(deleteScriptBtn);
scriptRenameBtn = new JButton();
scriptRenameBtn.setMinimumSize(new Dimension(58, 12));
scriptRenameBtn.setMaximumSize(new Dimension(58, 12));
scriptRenameBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tinaController.getJwfScriptController().scriptRename_clicked();
}
});
scriptRenameBtn.setToolTipText("Rename script");
scriptRenameBtn.setText("Ren");
scriptRenameBtn.setPreferredSize(new Dimension(58, 24));
scriptRenameBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
scriptRenameBtn.setBounds(new Rectangle(9, 280, 125, 24));
panel_2.add(scriptRenameBtn);
JPanel panel_3 = new JPanel();
panel_3.setMaximumSize(new Dimension(32767, 8));
panel_3.setMinimumSize(new Dimension(10, 8));
panel_3.setPreferredSize(new Dimension(116, 8));
panel_2.add(panel_3);
scriptRunBtn = new JButton();
scriptRunBtn.setMnemonic('u');
scriptRunBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tinaController.getJwfScriptController().scriptRunBtn_clicked();
}
});
panel_2.add(getScriptAddButtonBtn());
panel_2.add(getPanel_108());
scriptRunBtn.setToolTipText("Run script");
scriptRunBtn.setText("Run");
scriptRunBtn.setPreferredSize(new Dimension(116, 24));
scriptRunBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
scriptRunBtn.setBounds(new Rectangle(9, 280, 125, 24));
panel_2.add(scriptRunBtn);
panel_2.add(getPanel_113());
panel_2.add(getScriptEditBtn());
JScrollPane scrollPane_2 = new JScrollPane();
panel_1.add(scrollPane_2, BorderLayout.CENTER);
scriptTree = new JTree();
scriptTree.setFont(Prefs.getPrefs().getFont("SansSerif", Font.PLAIN, 10));
scriptTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
if (tinaController != null) {
tinaController.getJwfScriptController().scriptPropertiesTree_changed(e);
}
}
});
scrollPane_2.setViewportView(scriptTree);
scriptPanel.add(getTabbedPane(), BorderLayout.CENTER);
}
return scriptPanel;
}
use of javax.swing.event.TreeSelectionListener in project checkstyle-idea by jshiell.
the class CheckStyleToolWindowPanel method createToolPanel.
private JPanel createToolPanel() {
configurationOverrideCombo.setModel(configurationOverrideModel);
final int preferredHeight = configurationOverrideCombo.getPreferredSize().height;
configurationOverrideCombo.setPreferredSize(new Dimension(250, preferredHeight));
configurationOverrideCombo.setMaximumSize(new Dimension(350, preferredHeight));
treeModel = new ResultTreeModel();
resultsTree = new Tree(treeModel);
resultsTree.setRootVisible(false);
final TreeSelectionListener treeSelectionListener = new ToolWindowSelectionListener();
resultsTree.addTreeSelectionListener(treeSelectionListener);
final MouseListener treeMouseListener = new ToolWindowMouseListener();
resultsTree.addMouseListener(treeMouseListener);
resultsTree.addKeyListener(new ToolWindowKeyboardListener());
resultsTree.setCellRenderer(new ResultTreeRenderer());
progressLabel = new JLabel(" ");
progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
progressBar.setMinimum(0);
final Dimension progressBarSize = new Dimension(100, progressBar.getPreferredSize().height);
progressBar.setMinimumSize(progressBarSize);
progressBar.setPreferredSize(progressBarSize);
progressBar.setMaximumSize(progressBarSize);
progressPanel = new JToolBar(JToolBar.HORIZONTAL);
progressPanel.add(Box.createHorizontalStrut(4));
progressPanel.add(new JLabel(CheckStyleBundle.message("plugin.toolwindow.override")));
progressPanel.add(Box.createHorizontalStrut(4));
progressPanel.add(configurationOverrideCombo);
progressPanel.add(Box.createHorizontalStrut(4));
progressPanel.addSeparator();
progressPanel.add(Box.createHorizontalStrut(4));
progressPanel.add(progressLabel);
progressPanel.add(Box.createHorizontalGlue());
progressPanel.setFloatable(false);
progressPanel.setBackground(UIManager.getColor("Panel.background"));
progressPanel.setBorder(null);
final JPanel toolPanel = new JPanel(new BorderLayout());
toolPanel.add(new JBScrollPane(resultsTree), BorderLayout.CENTER);
toolPanel.add(progressPanel, BorderLayout.NORTH);
ToolTipManager.sharedInstance().registerComponent(resultsTree);
return toolPanel;
}
use of javax.swing.event.TreeSelectionListener in project pdfbox by apache.
the class PDFDebugger method initComponents.
/**
* This method is called from within the constructor to initialize the form.
*/
private void initComponents() {
jSplitPane1 = new javax.swing.JSplitPane();
jScrollPane1 = new JScrollPane();
tree = new Tree(this);
jScrollPane2 = new JScrollPane();
jTextPane1 = new javax.swing.JTextPane();
tree.setCellRenderer(new PDFTreeCellRenderer());
tree.setModel(null);
setTitle("Apache PDFBox Debugger");
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowOpened(WindowEvent windowEvent) {
tree.requestFocusInWindow();
super.windowOpened(windowEvent);
}
@Override
public void windowClosing(WindowEvent evt) {
exitForm(evt);
}
});
jScrollPane1.setBorder(new BevelBorder(BevelBorder.RAISED));
jScrollPane1.setPreferredSize(new Dimension(350, 500));
tree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent evt) {
jTree1ValueChanged(evt);
}
});
jScrollPane1.setViewportView(tree);
jSplitPane1.setRightComponent(jScrollPane2);
jSplitPane1.setDividerSize(3);
jScrollPane2.setPreferredSize(new Dimension(300, 500));
jScrollPane2.setViewportView(jTextPane1);
jSplitPane1.setLeftComponent(jScrollPane1);
JScrollPane documentScroller = new JScrollPane();
documentScroller.setViewportView(documentPanel);
statusPane = new TreeStatusPane(tree);
statusPane.getPanel().setBorder(new BevelBorder(BevelBorder.RAISED));
statusPane.getPanel().setPreferredSize(new Dimension(300, 25));
getContentPane().add(statusPane.getPanel(), BorderLayout.PAGE_START);
getContentPane().add(jSplitPane1, BorderLayout.CENTER);
statusBar = new ReaderBottomPanel();
getContentPane().add(statusBar, BorderLayout.SOUTH);
// create menus
JMenuBar menuBar = new JMenuBar();
menuBar.add(createFileMenu());
menuBar.add(createEditMenu());
ViewMenu viewMenu = ViewMenu.getInstance(this);
menuBar.add(viewMenu.getMenu());
setJMenuBar(menuBar);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int width = 1000;
int height = 970;
setBounds((screenSize.width - width) / 2, (screenSize.height - height) / 2, width, height);
// drag and drop to open files
setTransferHandler(new TransferHandler() {
@Override
public boolean canImport(TransferSupport transferSupport) {
return transferSupport.isDataFlavorSupported(DataFlavor.javaFileListFlavor);
}
@Override
@SuppressWarnings("unchecked")
public boolean importData(TransferSupport transferSupport) {
try {
Transferable transferable = transferSupport.getTransferable();
List<File> files = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
readPDFFile(files.get(0), "");
return true;
} catch (IOException e) {
new ErrorDialog(e).setVisible(true);
return true;
} catch (UnsupportedFlavorException e) {
throw new RuntimeException(e);
}
}
});
// Mac OS X file open/quit handler
if (IS_MAC_OS && !isMinJdk9()) {
// TODO this needs to be rewritten for JDK9, see PDFBOX-4013
try {
Method osxOpenFiles = getClass().getDeclaredMethod("osxOpenFiles", String.class);
osxOpenFiles.setAccessible(true);
OSXAdapter.setFileHandler(this, osxOpenFiles);
Method osxQuit = getClass().getDeclaredMethod("osxQuit");
osxQuit.setAccessible(true);
OSXAdapter.setQuitHandler(this, osxQuit);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}
use of javax.swing.event.TreeSelectionListener in project sldeditor by robward-scisys.
the class ExpressionPanelv2 method createUI.
/**
* Creates the ui.
*/
private void createUI() {
JPanel treePanel = new JPanel();
getContentPane().add(treePanel, BorderLayout.WEST);
treePanel.setLayout(new BorderLayout(0, 0));
JScrollPane scrollPane = new JScrollPane();
treePanel.add(scrollPane);
Dimension preferredSize = new Dimension(400, 350);
scrollPane.setPreferredSize(preferredSize);
model = new ExpressionTreeModel(rootNode);
tree = new JTree(model);
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
treeSelected(selectedNode);
}
});
scrollPane.setViewportView(tree);
dataPanel = new JPanel(new CardLayout());
dataPanel.add(emptyPanel, EMPTY_PANEL);
expressionPanel = new ExpressionSubPanel(this);
dataPanel.add(expressionPanel, ExpressionSubPanel.class.getName());
filterPanel = new FilterSubPanel(this);
dataPanel.add(filterPanel, FilterSubPanel.class.getName());
literalPanel = new LiteralPanel(this);
dataPanel.add(literalPanel, LiteralPanel.class.getName());
propertyPanel = new PropertyPanel(this);
dataPanel.add(propertyPanel, PropertyPanel.class.getName());
envVarPanel = new EnvVarPanel(this);
dataPanel.add(envVarPanel, EnvVarPanel.class.getName());
getContentPane().add(dataPanel, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
flowLayout.setAlignment(FlowLayout.TRAILING);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
btnOk = new JButton(Localisation.getString(ExpressionPanelv2.class, "common.ok"));
btnOk.setEnabled(false);
btnOk.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
okButtonPressed = true;
setVisible(false);
}
});
buttonPanel.add(btnOk);
JButton btnCancel = new JButton(Localisation.getString(ExpressionPanelv2.class, "common.cancel"));
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
okButtonPressed = false;
setVisible(false);
}
});
buttonPanel.add(btnCancel);
JPanel resultPanel = new JPanel();
getContentPane().add(resultPanel, BorderLayout.NORTH);
resultPanel.setLayout(new BorderLayout(0, 0));
JScrollPane scrollPane_1 = new JScrollPane();
resultPanel.add(scrollPane_1);
textArea = new JTextArea();
textArea.setEditable(false);
scrollPane_1.setViewportView(textArea);
}
Aggregations