Search in sources :

Example 86 with MouseListener

use of java.awt.event.MouseListener in project LauncherV3 by TechnicPack.

the class ModpackBanner method initComponents.

private void initComponents() {
    this.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    this.add(Box.createRigidArea(new Dimension(20, 10)));
    modpackIcon = new JLabel();
    modpackIcon.setIcon(resources.getIcon("icon.png"));
    this.add(modpackIcon);
    JPanel modpackNamePanel = new JPanel();
    modpackNamePanel.setOpaque(false);
    modpackNamePanel.setLayout(new BoxLayout(modpackNamePanel, BoxLayout.PAGE_AXIS));
    this.add(modpackNamePanel);
    modpackName = new JLabel("Modpack");
    modpackName.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    modpackName.setFont(resources.getFont(ResourceLoader.FONT_RALEWAY, 26));
    modpackName.setHorizontalTextPosition(SwingConstants.LEFT);
    modpackName.setAlignmentX(LEFT_ALIGNMENT);
    modpackName.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    modpackName.setOpaque(false);
    modpackNamePanel.add(modpackName);
    modpackTags = new JPanel();
    modpackTags.setLayout(new BoxLayout(modpackTags, BoxLayout.LINE_AXIS));
    modpackTags.setBorder(BorderFactory.createEmptyBorder(0, 2, 2, 2));
    modpackTags.setOpaque(false);
    modpackTags.setAlignmentX(LEFT_ALIGNMENT);
    modpackNamePanel.add(modpackTags);
    this.add(Box.createHorizontalGlue());
    JPanel packDoodads = new JPanel();
    packDoodads.setOpaque(false);
    packDoodads.setLayout(new BoxLayout(packDoodads, BoxLayout.PAGE_AXIS));
    JPanel versionPanel = new JPanel();
    versionPanel.setOpaque(false);
    versionPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    versionPanel.setAlignmentX(RIGHT_ALIGNMENT);
    packDoodads.add(versionPanel);
    versionPanel.add(Box.createRigidArea(new Dimension(1, 20)));
    updateReady = new JLabel();
    updateReady.setIcon(resources.getIcon("update_available.png"));
    updateReady.setHorizontalTextPosition(SwingConstants.LEADING);
    updateReady.setHorizontalAlignment(SwingConstants.RIGHT);
    updateReady.setAlignmentX(RIGHT_ALIGNMENT);
    updateReady.setVisible(false);
    versionPanel.add(updateReady);
    versionText = new JLabel(resources.getString("launcher.packbanner.version"));
    versionText.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    versionText.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    versionText.setHorizontalTextPosition(SwingConstants.LEADING);
    versionText.setHorizontalAlignment(SwingConstants.RIGHT);
    versionText.setAlignmentX(RIGHT_ALIGNMENT);
    versionText.setVisible(false);
    versionPanel.add(versionText);
    installedVersion = new JLabel("1.0.7");
    installedVersion.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    installedVersion.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    installedVersion.setHorizontalTextPosition(SwingConstants.LEADING);
    installedVersion.setHorizontalAlignment(SwingConstants.RIGHT);
    installedVersion.setAlignmentX(RIGHT_ALIGNMENT);
    installedVersion.setVisible(false);
    versionPanel.add(installedVersion);
    packDoodads.add(Box.createRigidArea(new Dimension(0, 5)));
    modpackOptions = new JLabel(resources.getString("launcher.packbanner.options"));
    modpackOptions.setIcon(new ImageIcon(resources.colorImage(resources.getImage("options_cog.png"), LauncherFrame.COLOR_BUTTON_BLUE)));
    modpackOptions.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Font font = resources.getFont(ResourceLoader.FONT_OPENSANS, 14);
    modpackOptions.setFont(font);
    modpackOptions.setForeground(LauncherFrame.COLOR_BLUE);
    modpackOptions.setHorizontalTextPosition(SwingConstants.LEADING);
    modpackOptions.setHorizontalAlignment(SwingConstants.RIGHT);
    modpackOptions.setAlignmentX(RIGHT_ALIGNMENT);
    modpackOptions.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            openModpackOptions();
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }
    });
    packDoodads.add(modpackOptions);
    this.add(packDoodads);
    this.add(Box.createRigidArea(new Dimension(8, 10)));
}
Also used : MouseListener(java.awt.event.MouseListener) MouseEvent(java.awt.event.MouseEvent)

Example 87 with MouseListener

use of java.awt.event.MouseListener in project jPOS by jpos.

the class ISORequestListenerPanel method createPanel.

private JPanel createPanel() {
    JPanel A = new JPanel() {

        private static final long serialVersionUID = -6042644671679973897L;

        public Insets getInsets() {
            return new Insets(10, 10, 10, 10);
        }
    };
    A.setLayout(new BorderLayout());
    JLabel l = new JLabel(symbolicName);
    A.add(l, BorderLayout.NORTH);
    final JList logList = new JList(log);
    logList.setPrototypeCellValue("9999 99999999 999999");
    MouseListener mouseListener = new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            ISOMsg m = (ISOMsg) logList.getSelectedValue();
            if (m != null) {
                JFrame f = new JFrame(m.toString());
                ISOMsgPanel p = new ISOMsgPanel(m);
                f.getContentPane().add(p);
                f.pack();
                f.show();
            }
        }
    };
    logList.addMouseListener(mouseListener);
    JScrollPane scrollPane = new JScrollPane(logList);
    scrollPane.setPreferredSize(new Dimension(170, 200));
    A.add(scrollPane, BorderLayout.SOUTH);
    return A;
}
Also used : MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) MouseListener(java.awt.event.MouseListener) ISOMsg(org.jpos.iso.ISOMsg)

Example 88 with MouseListener

use of java.awt.event.MouseListener in project vcell by virtualcell.

the class BioModelPropertiesPanel method updateInterface.

/**
 * Comment
 */
private void updateInterface() {
    if (bioModel == null || bioModelWindowManager == null) {
        return;
    }
    nameLabel.setText("<html><b>" + bioModel.getName() + "</b></html>");
    Version version = bioModel.getVersion();
    if (version != null) {
        ownerLabel.setText(version.getOwner().getName());
        String text = "biomodel-" + version.getVersionKey().toString();
        idLabel.setText(text);
        lastModifiedLabel.setText(version.getDate().toString());
        try {
            // permissions
            BioModelInfo bioModelInfo = bioModelWindowManager.getRequestManager().getDocumentManager().getBioModelInfo(version.getVersionKey());
            String permissions = bioModelInfo.getVersion().getGroupAccess().getDescription();
            if (bioModelInfo.getPublicationInfos() != null && bioModelInfo.getPublicationInfos().length > 0) {
                if (bioModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Published)) {
                    // must be Public
                    permissions = "Published";
                } else {
                    permissions = "Curated";
                }
            } else if (bioModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Archived)) {
                permissions += "Archived";
            }
            permissionLabel.setText(permissions);
        } catch (DataAccessException e) {
            e.printStackTrace();
        }
        changePermissionButton.setEnabled(true);
    }
    // not in use anymore and unmaintained
    webLinksPanel.removeAll();
    webLinksPanel.setLayout(new GridLayout(0, 1));
    Set<MiriamRefGroup> resources = new HashSet<MiriamRefGroup>();
    Set<MiriamRefGroup> isDescribedByAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_isDescribedBy);
    Set<MiriamRefGroup> isAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_is);
    resources.addAll(isDescribedByAnnotation);
    resources.addAll(isAnnotation);
    for (MiriamRefGroup refGroup : resources) {
        for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
            LinkNode linkNode = new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_isDescribedBy, miriamResources);
            final String link = linkNode.getLink();
            String labelText = miriamResources.getDataType() == null ? "" : miriamResources.getDataType().getDataTypeName();
            String toolTip = null;
            if (link != null) {
                toolTip = "double-click to open link " + link;
                labelText = "<html><b>" + labelText + "</b>&nbsp;" + "<font color=blue><a href=" + link + ">" + link + "</a></font></html>";
            }
            JLabel label = new JLabel(labelText);
            label.addMouseListener(new MouseListener() {

                public void mouseReleased(MouseEvent e) {
                }

                public void mousePressed(MouseEvent e) {
                }

                public void mouseExited(MouseEvent e) {
                }

                public void mouseEntered(MouseEvent e) {
                }

                public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() == 2) {
                        DialogUtils.browserLauncher(BioModelPropertiesPanel.this, link, "failed to open " + link);
                    }
                }
            });
            label.setToolTipText(toolTip);
            webLinksPanel.add(label);
        }
    }
    applicationsPanel.updateInterface();
}
Also used : MouseEvent(java.awt.event.MouseEvent) BioModelInfo(org.vcell.util.document.BioModelInfo) JLabel(javax.swing.JLabel) GridLayout(java.awt.GridLayout) MouseListener(java.awt.event.MouseListener) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) Version(org.vcell.util.document.Version) LinkNode(cbit.vcell.xml.gui.MiriamTreeModel.LinkNode) DataAccessException(org.vcell.util.DataAccessException) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) HashSet(java.util.HashSet)

Example 89 with MouseListener

use of java.awt.event.MouseListener in project vcell by virtualcell.

the class BioModelTreePanel method getJTree2.

/**
 * Return the JTree2 property value.
 * @return cbit.gui.JTreeFancy
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JTree getJTree2() {
    if (ivjJTree2 == null) {
        try {
            javax.swing.tree.DefaultTreeSelectionModel ivjLocalSelectionModel;
            ivjLocalSelectionModel = new javax.swing.tree.DefaultTreeSelectionModel();
            ivjLocalSelectionModel.setRowMapper(getLocalSelectionModelVariableHeightLayoutCache());
            ivjJTree2 = new JTree();
            ivjJTree2.setName("JTree2");
            ivjJTree2.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("loading", false)));
            ivjJTree2.setBounds(0, 0, 78, 72);
            ivjJTree2.setRootVisible(true);
            ivjJTree2.setSelectionModel(ivjLocalSelectionModel);
            MouseListener mouseListener = new MouseAdapter() {

                public void mousePressed(MouseEvent e) {
                    if (e.getClickCount() == 2) {
                        Object node = ivjJTree2.getLastSelectedPathComponent();
                        if (node instanceof LinkNode) {
                            String link = ((LinkNode) node).getLink();
                            if (link != null) {
                                DialogUtils.browserLauncher(ivjJTree2, link, "failed to launch");
                            }
                        }
                    }
                }
            };
            ivjJTree2.addMouseListener(mouseListener);
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return ivjJTree2;
}
Also used : MouseEvent(java.awt.event.MouseEvent) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MouseAdapter(java.awt.event.MouseAdapter) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) JTree(javax.swing.JTree) MouseListener(java.awt.event.MouseListener) LinkNode(cbit.vcell.xml.gui.MiriamTreeModel.LinkNode)

Example 90 with MouseListener

use of java.awt.event.MouseListener in project drools by kiegroup.

the class AdventureFrame method createBuildActionsPanel.

private void createBuildActionsPanel(JPanel parent) {
    parent.add(createLabel("Actions"), "wrap, spanx 3");
    JPanel actionsPanel = new JPanel();
    actionsPanel.setBorder(null);
    actionsPanel.setLayout(new BoxLayout(actionsPanel, BoxLayout.Y_AXIS));
    JButton moveBtn = new JButton("Move");
    moveBtn.setToolTipText("Select one Room from the Exits, then press Send");
    actionsPanel.add(moveBtn);
    // msg = new ACLMessage();
    // msg.setPerformative( Performative.REQUEST );
    moveBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Move ");
            cmd = new ArrayList();
            cmd.add(MoveCommand.class);
            cmd.add(characterSelectCombo.getSelectedObjects()[0]);
        }
    });
    JButton pickupBtn = new JButton("Pick Up");
    pickupBtn.setToolTipText("Select one from the Items list, then press Send");
    actionsPanel.add(pickupBtn);
    pickupBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Pickup ");
            cmd = new ArrayList();
            cmd.add(PickupCommand.class);
            cmd.add(characterSelectCombo.getSelectedObjects()[0]);
        }
    });
    JButton dropBtn = new JButton("Drop");
    dropBtn.setToolTipText("Select one from the Inventory, then press Send");
    actionsPanel.add(dropBtn);
    dropBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Drop ");
            cmd = new ArrayList();
            cmd.add(DropCommand.class);
            cmd.add(characterSelectCombo.getSelectedObjects()[0]);
        }
    });
    JButton giveBtn = new JButton("Give");
    giveBtn.setToolTipText("Select one from the Inventory, then Select the target Character, then press Send");
    actionsPanel.add(giveBtn);
    giveBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Give ");
            cmd = new ArrayList();
            cmd.add(GiveCommand.class);
            cmd.add(characterSelectCombo.getSelectedObjects()[0]);
        }
    });
    JButton useBtn = new JButton("Use");
    useBtn.setToolTipText("Select one from the Inventory, then Select the target Thing or Room");
    actionsPanel.add(useBtn);
    useBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Use ");
            cmd = new ArrayList();
            cmd.add(UseCommand.class);
            cmd.add(characterSelectCombo.getSelectedObjects()[0]);
        }
    });
    JButton lookBtn = new JButton("Look");
    giveBtn.setToolTipText("Just press Send");
    actionsPanel.add(lookBtn);
    lookBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Look ");
            cmd = new ArrayList();
            cmd.add(LookCommand.class);
            cmd.add(characterSelectCombo.getSelectedObjects()[0]);
        }
    });
    JButton searchBtn = new JButton("Search");
    giveBtn.setToolTipText("Select the item to search, then press send.");
    actionsPanel.add(searchBtn);
    searchBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cmdTextField.setText("Search ");
            cmd = new ArrayList();
            cmd.add(SearchCommand.class);
        }
    });
    parent.add(actionsPanel, "top, left");
    thingsTable = new JTable();
    thingsTable.setPreferredScrollableViewportSize(new Dimension(245, 250));
    thingsTable.setBorder(null);
    thingsTable.setModel(new NonEditableTableMode(new Object[][] {}, new String[] { "Things" }));
    thingsTable.addMouseListener(new MouseListener() {

        public void mouseReleased(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
        }

        public void mouseEntered(MouseEvent e) {
        }

        public void mouseClicked(MouseEvent e) {
            if (cmd == null) {
                return;
            }
            int row = thingsTable.rowAtPoint(e.getPoint());
            int col = thingsTable.columnAtPoint(e.getPoint());
            Thing t = (Thing) thingsTable.getModel().getValueAt(row, col);
            cmdTextField.setText(cmdTextField.getText() + t.getName() + " ");
            cmd.add(t);
        }
    });
    JScrollPane itemsPanel = new JScrollPane(thingsTable);
    parent.add(itemsPanel, "top, left");
    exitsTable = new JTable();
    exitsTable.setPreferredScrollableViewportSize(new Dimension(245, 250));
    exitsTable.setBorder(null);
    exitsTable.setModel(new NonEditableTableMode(new Object[][] {}, new String[] { "Exits" }));
    exitsTable.addMouseListener(new MouseListener() {

        public void mouseReleased(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
        }

        public void mouseEntered(MouseEvent e) {
        }

        public void mouseClicked(MouseEvent e) {
            if (cmd == null) {
                return;
            }
            int row = exitsTable.rowAtPoint(e.getPoint());
            int col = exitsTable.columnAtPoint(e.getPoint());
            Room r = (Room) exitsTable.getModel().getValueAt(row, col);
            cmdTextField.setText(cmdTextField.getText() + r.getName() + " ");
            cmd.add(r);
        }
    });
    JScrollPane exitsPanel = new JScrollPane(exitsTable);
    parent.add(exitsPanel, "top, left, wrap");
}
Also used : MouseEvent(java.awt.event.MouseEvent) ActionEvent(java.awt.event.ActionEvent) ArrayList(java.util.ArrayList) MouseListener(java.awt.event.MouseListener) ActionListener(java.awt.event.ActionListener)

Aggregations

MouseListener (java.awt.event.MouseListener)104 MouseEvent (java.awt.event.MouseEvent)67 Dimension (java.awt.Dimension)21 JLabel (javax.swing.JLabel)20 MouseAdapter (java.awt.event.MouseAdapter)19 JPanel (javax.swing.JPanel)16 Component (java.awt.Component)14 JComponent (javax.swing.JComponent)14 ActionEvent (java.awt.event.ActionEvent)13 ActionListener (java.awt.event.ActionListener)11 MouseMotionListener (java.awt.event.MouseMotionListener)11 JButton (javax.swing.JButton)11 JScrollPane (javax.swing.JScrollPane)11 Insets (java.awt.Insets)8 BorderLayout (java.awt.BorderLayout)7 Color (java.awt.Color)7 Point (java.awt.Point)7 File (java.io.File)7 ImageIcon (javax.swing.ImageIcon)6 JCheckBox (javax.swing.JCheckBox)6