Search in sources :

Example 56 with JScrollPane

use of javax.swing.JScrollPane in project jna by java-native-access.

the class BalloonManagerDemo method main.

public static void main(String[] args) {
    try {
        System.setProperty("sun.java2d.noddraw", "true");
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
    }
    JFrame f = new JFrame("Balloon Test");
    final String BALLOON_TEXT = "<html><center>" + "This is some sample balloon text<br>" + "which has been formatted with html.<br>" + "Click to dismiss.</center></html>";
    final JLabel content = new JLabel(BALLOON_TEXT);
    content.setIconTextGap(10);
    content.setBorder(new EmptyBorder(0, 8, 0, 8));
    content.setSize(content.getPreferredSize());
    content.setIcon(new InfoIcon());
    JLabel label = new JLabel("Click anywhere for more information");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.addMouseListener(new MouseAdapter() {

        private MouseListener listener = new MouseAdapter() {

            public void mousePressed(MouseEvent e) {
                hidePopup(e);
            }
        };

        private Popup popup;

        private void hidePopup(MouseEvent e) {
            e.getComponent().removeMouseListener(listener);
            if (popup != null)
                popup.hide();
        }

        public void mousePressed(MouseEvent e) {
            hidePopup(e);
            popup = BalloonManager.getBalloon(e.getComponent(), content, e.getX(), e.getY());
            popup.show();
            content.getParent().addMouseListener(listener);
        }
    });
    f.getContentPane().add(label);
    f.pack();
    f.setSize(new Dimension(300, 300));
    f.setLocation(100, 100);
    try {
        // Force a load of JNA
        WindowUtils.setWindowMask(f, WindowUtils.MASK_NONE);
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } catch (UnsatisfiedLinkError e) {
        e.printStackTrace();
        String msg = e.getMessage() + "\nError loading the JNA library";
        JTextArea area = new JTextArea(msg);
        area.setOpaque(false);
        area.setFont(UIManager.getFont("Label.font"));
        area.setEditable(false);
        area.setColumns(80);
        area.setRows(8);
        area.setWrapStyleWord(true);
        area.setLineWrap(true);
        JOptionPane.showMessageDialog(null, new JScrollPane(area), "Library Load Error: " + System.getProperty("os.name") + "/" + System.getProperty("os.arch"), JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) JTextArea(javax.swing.JTextArea) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) MouseListener(java.awt.event.MouseListener) JFrame(javax.swing.JFrame) Popup(javax.swing.Popup) EmptyBorder(javax.swing.border.EmptyBorder)

Example 57 with JScrollPane

use of javax.swing.JScrollPane in project qi4j-sdk by Qi4j.

the class APIPane method $$$setupUI$$$.

/**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout(0, 0));
    final JScrollPane scrollPane1 = new JScrollPane();
    contentPane.add(scrollPane1, BorderLayout.CENTER);
    apiTable = new JTable();
    apiTable.setShowVerticalLines(true);
    scrollPane1.setViewportView(apiTable);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable)

Example 58 with JScrollPane

use of javax.swing.JScrollPane in project qi4j-sdk by Qi4j.

the class DependencyPane method $$$setupUI$$$.

/**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout(0, 0));
    splitPane = new JSplitPane();
    contentPane.add(splitPane, BorderLayout.CENTER);
    final JScrollPane scrollPane1 = new JScrollPane();
    splitPane.setLeftComponent(scrollPane1);
    fieldList = new JList();
    scrollPane1.setViewportView(fieldList);
    detailPane = new JPanel();
    detailPane.setLayout(new GridBagLayout());
    splitPane.setRightComponent(detailPane);
    detailPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8), null));
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_ClassName.Text"));
    GridBagConstraints gbc;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.EAST;
    detailPane.add(label1, gbc);
    final JPanel spacer1 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    detailPane.add(spacer1, gbc);
    final JPanel spacer2 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.VERTICAL;
    detailPane.add(spacer2, gbc);
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_Optional.Text"));
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.anchor = GridBagConstraints.EAST;
    detailPane.add(label2, gbc);
    final JLabel label3 = new JLabel();
    this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_Annotation.Text"));
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.EAST;
    detailPane.add(label3, gbc);
    final JPanel spacer3 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.VERTICAL;
    detailPane.add(spacer3, gbc);
    final JPanel spacer4 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.fill = GridBagConstraints.VERTICAL;
    detailPane.add(spacer4, gbc);
    final JPanel spacer5 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 9;
    gbc.fill = GridBagConstraints.VERTICAL;
    detailPane.add(spacer5, gbc);
    final JLabel label4 = new JLabel();
    this.$$$loadLabelText$$$(label4, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_InjectionType.Text"));
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 10;
    gbc.anchor = GridBagConstraints.EAST;
    detailPane.add(label4, gbc);
    classNameLabel = new JLabel();
    classNameLabel.setText("none");
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.WEST;
    detailPane.add(classNameLabel, gbc);
    annotationLabel = new JLabel();
    annotationLabel.setText("none");
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.WEST;
    detailPane.add(annotationLabel, gbc);
    injectionTypeLabel = new JLabel();
    injectionTypeLabel.setText("none");
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 10;
    gbc.anchor = GridBagConstraints.WEST;
    detailPane.add(injectionTypeLabel, gbc);
    optionalLabel = new JLabel();
    optionalLabel.setText("none");
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbc.anchor = GridBagConstraints.WEST;
    detailPane.add(optionalLabel, gbc);
    final JPanel spacer6 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 7;
    gbc.fill = GridBagConstraints.VERTICAL;
    detailPane.add(spacer6, gbc);
    final JLabel label5 = new JLabel();
    this.$$$loadLabelText$$$(label5, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_Injection.Text"));
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 8;
    gbc.anchor = GridBagConstraints.WEST;
    detailPane.add(label5, gbc);
    final JScrollPane scrollPane2 = new JScrollPane();
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 12;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    detailPane.add(scrollPane2, gbc);
    injectedServiceList = new JList();
    scrollPane2.setViewportView(injectedServiceList);
    final JPanel spacer7 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 11;
    gbc.fill = GridBagConstraints.VERTICAL;
    detailPane.add(spacer7, gbc);
    final JLabel label6 = new JLabel();
    this.$$$loadLabelText$$$(label6, ResourceBundle.getBundle("org/qi4j/envisage/detail/DependencyPane").getString("CTL_InjectedServices.Text"));
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 12;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    detailPane.add(label6, gbc);
    final JSeparator separator1 = new JSeparator();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 6;
    gbc.gridwidth = 3;
    gbc.fill = GridBagConstraints.BOTH;
    detailPane.add(separator1, gbc);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JSplitPane(javax.swing.JSplitPane) JList(javax.swing.JList) JSeparator(javax.swing.JSeparator)

Example 59 with JScrollPane

use of javax.swing.JScrollPane in project LogisticsPipes by RS485.

the class DebugHelper method handleItemTooltip.

@Override
public List<String> handleItemTooltip(GuiContainer gui, final ItemStack itemstack, int paramInt1, int paramInt2, List<String> currenttip) {
    if (Configs.TOOLTIP_INFO && itemstack != null) {
        if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && Keyboard.isKeyDown(Keyboard.KEY_H)) {
            if (DebugHelper.lastTime + 1000 < System.currentTimeMillis()) {
                DebugHelper.lastTime = System.currentTimeMillis();
                new Thread(() -> {
                    while (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_H)) {
                        try {
                            Thread.sleep(50);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                    DefaultMutableTreeNode node = new DefaultMutableTreeNode(ItemIdentifier.get(itemstack).getFriendlyName());
                    node.add(new DefaultMutableTreeNode("ItemId: " + Item.getIdFromItem(itemstack.getItem())));
                    node.add(new DefaultMutableTreeNode("ItemDamage: " + itemstack.getItemDamage()));
                    if (itemstack.hasTagCompound()) {
                        DefaultMutableTreeNode tag = new DefaultMutableTreeNode("Tag:");
                        try {
                            addNBTToTree(itemstack.getTagCompound(), tag);
                        } catch (Exception e) {
                            tag.add(new DefaultMutableTreeNode(e));
                        }
                        node.add(tag);
                    }
                    JTree tree = new JTree(node);
                    JScrollPane treeView = new JScrollPane(tree);
                    JFrame frame = new JFrame("Item Info");
                    frame.getContentPane().add(treeView, BorderLayout.CENTER);
                    frame.setLocationRelativeTo(null);
                    frame.pack();
                    frame.setVisible(true);
                }).start();
            }
        }
    }
    return currenttip;
}
Also used : JScrollPane(javax.swing.JScrollPane) JTree(javax.swing.JTree) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) JFrame(javax.swing.JFrame)

Example 60 with JScrollPane

use of javax.swing.JScrollPane in project neo4j by neo4j.

the class ScrollableOptionPane method createWrappingScrollPane.

private static JScrollPane createWrappingScrollPane(String message) {
    JTextArea view = new JTextArea(message, 10, 80);
    view.setLineWrap(true);
    view.setEditable(false);
    view.setWrapStyleWord(true);
    return new JScrollPane(view);
}
Also used : JScrollPane(javax.swing.JScrollPane) JTextArea(javax.swing.JTextArea)

Aggregations

JScrollPane (javax.swing.JScrollPane)832 JPanel (javax.swing.JPanel)431 Dimension (java.awt.Dimension)271 JLabel (javax.swing.JLabel)269 BorderLayout (java.awt.BorderLayout)260 JButton (javax.swing.JButton)191 GridBagLayout (java.awt.GridBagLayout)149 JTable (javax.swing.JTable)148 BoxLayout (javax.swing.BoxLayout)140 Insets (java.awt.Insets)122 GridBagConstraints (java.awt.GridBagConstraints)121 ActionEvent (java.awt.event.ActionEvent)120 JTextArea (javax.swing.JTextArea)110 ActionListener (java.awt.event.ActionListener)103 FlowLayout (java.awt.FlowLayout)96 JTextField (javax.swing.JTextField)70 FormLayout (com.jgoodies.forms.layout.FormLayout)60 Container (java.awt.Container)55 JSplitPane (javax.swing.JSplitPane)55 MouseEvent (java.awt.event.MouseEvent)52