Search in sources :

Example 1 with JPanelForTree

use of org.freeinternals.commonlib.ui.JPanelForTree in project selenium_java by sergueik.

the class Main method open_JarFile.

private void open_JarFile(final File file) {
    try {
        this.zftree = new JTreeZipFile(new JarFile(file, false, JarFile.OPEN_READ));
        this.zftree.addMouseListener(new MouseAdapter() {

            @Override
            public void mousePressed(final MouseEvent e) {
                if (e.getClickCount() != 2) {
                    return;
                }
                if (zftree.getRowForLocation(e.getX(), e.getY()) == -1) {
                    return;
                }
                zftree_DoubleClick(zftree.getPathForLocation(e.getX(), e.getY()));
            }
        });
    } catch (IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        JOptionPane.showMessageDialog(this, ex.toString(), this.getTitle(), JOptionPane.ERROR_MESSAGE);
    }
    if (this.zftree != null) {
        this.zftreeContainer = new JPanelForTree(this.zftree, this);
        this.add(this.zftreeContainer, BorderLayout.CENTER);
        this.resizeForContent();
    }
}
Also used : MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JPanelForTree(org.freeinternals.commonlib.ui.JPanelForTree) IOException(java.io.IOException) JarFile(java.util.jar.JarFile) JTreeZipFile(org.freeinternals.javaclassviewer.ui.JTreeZipFile)

Example 2 with JPanelForTree

use of org.freeinternals.commonlib.ui.JPanelForTree in project selenium_java by sergueik.

the class JSplitPaneClassFile method createAndShowGUI.

private void createAndShowGUI(JFrame top) {
    // Construct class file viewer
    final JTreeClassFile jTreeClassFile = new JTreeClassFile(this.classFile);
    jTreeClassFile.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(final javax.swing.event.TreeSelectionEvent evt) {
            jTreeClassFileSelectionChanged(evt);
        }
    });
    final JPanelForTree panel = new JPanelForTree(jTreeClassFile, top);
    final JTabbedPane tabbedPane = new JTabbedPane();
    // Construct binary viewer
    this.binaryViewer = new JBinaryViewer();
    this.binaryViewer.setData(this.classFile.getClassByteArray());
    this.binaryViewerView = new JScrollPane(this.binaryViewer);
    this.binaryViewerView.getVerticalScrollBar().setValue(0);
    tabbedPane.add("Class File", this.binaryViewerView);
    // Construct opcode viewer
    this.opcode = new JTextPane();
    this.opcode.setAlignmentX(Component.LEFT_ALIGNMENT);
    // this.opcode.setFont(new Font(Font.DIALOG_INPUT, Font.PLAIN, 14));
    this.opcode.setEditable(false);
    this.opcode.setBorder(null);
    this.opcode.setContentType("text/html");
    tabbedPane.add("Opcode", new JScrollPane(this.opcode));
    // Class report
    this.report = new JTextPane();
    this.report.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.report.setEditable(false);
    this.report.setBorder(null);
    this.report.setContentType("text/html");
    tabbedPane.add("Report", new JScrollPane(this.report));
    this.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    this.setDividerSize(5);
    this.setDividerLocation(280);
    this.setLeftComponent(panel);
    this.setRightComponent(tabbedPane);
    this.binaryViewerView.getVerticalScrollBar().setValue(0);
}
Also used : JScrollPane(javax.swing.JScrollPane) JTextPane(javax.swing.JTextPane) JTabbedPane(javax.swing.JTabbedPane) JPanelForTree(org.freeinternals.commonlib.ui.JPanelForTree) TreeSelectionListener(javax.swing.event.TreeSelectionListener) JBinaryViewer(org.freeinternals.commonlib.ui.JBinaryViewer) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

Aggregations

JPanelForTree (org.freeinternals.commonlib.ui.JPanelForTree)2 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 IOException (java.io.IOException)1 JarFile (java.util.jar.JarFile)1 JScrollPane (javax.swing.JScrollPane)1 JTabbedPane (javax.swing.JTabbedPane)1 JTextPane (javax.swing.JTextPane)1 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1 JBinaryViewer (org.freeinternals.commonlib.ui.JBinaryViewer)1 JTreeZipFile (org.freeinternals.javaclassviewer.ui.JTreeZipFile)1