List of usage examples for java.awt.event MouseAdapter MouseAdapter
MouseAdapter
From source file:com.mirth.connect.manager.ManagerDialog.java
private void initInfoPanel() { infoPanel = new JPanel(new MigLayout("insets 8, novisualpadding, hidemode 3", "[right][left]")); infoPanel.setBackground(new Color(255, 255, 255)); infoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); serverVersionLabel = new JLabel("Server Version:"); serverVersionField = new JLabel("version"); serverIdLabel = new JLabel("Server ID:"); serverIdField = new JLabel("serverId"); javaVersionLabel = new JLabel("Java Version:"); javaVersionField = new JLabel("javaVersion"); contactPrefixLabel = new JLabel("Need Help? Contact"); mirthSupportLink = new JLabel("<html><font color=blue><u>Mirth Corporation</u></font></html>"); mirthSupportLink.setToolTipText("Visit Mirth Corporation's website."); mirthSupportLink.setCursor(new Cursor(Cursor.HAND_CURSOR)); mirthSupportLink.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { mirthSupportLinkMouseClicked(evt); }/*from w w w . j a v a 2 s .co m*/ }); contactPostfixLabel = new JLabel("for professional support."); }
From source file:com.mgmtp.jfunk.core.ui.JFunkFrame.java
private void buildTree() { tree = new JTree(new ScriptsTreeModel(roots)); tree.setCellRenderer(new ScriptsTreeCellRenderer()); tree.setRootVisible(false);/*from w w w. ja va2 s. co m*/ tree.setShowsRootHandles(true); tree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { runScripts(); } } }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (!e.isPopupTrigger() && e.getClickCount() == 2) { if (tree.getModel().isLeaf(tree.getSelectionPath().getLastPathComponent())) { runScripts(); } } } @Override public void mousePressed(final MouseEvent e) { if (e.isPopupTrigger()) { TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); TreePath[] paths = tree.getSelectionPaths(); boolean newPath = true; for (TreePath path : paths) { if (selPath.equals(path)) { newPath = false; break; } } if (newPath) { tree.setSelectionPath(selPath); } popup.show((Component) e.getSource(), e.getX(), e.getY()); } } @Override public void mouseReleased(final MouseEvent e) { if (e.isPopupTrigger()) { TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); TreePath[] paths = tree.getSelectionPaths(); boolean newPath = true; for (TreePath path : paths) { if (selPath.equals(path)) { newPath = false; break; } } if (newPath) { tree.setSelectionPath(selPath); } popup.show((Component) e.getSource(), e.getX(), e.getY()); } } }); }
From source file:edu.pdi2.visual.ThresholdSignature.java
private void initGUI(int cantBands) { try {//from w ww. j a v a2 s. c o m { getContentPane().setLayout(null); this.setPreferredSize(new java.awt.Dimension(359, 457)); { for (int i = 0; i < cantBands; ++i) { scrollbars[i] = new JScrollBar(); getContentPane().add(scrollbars[i]); scrollbars[i].setBounds(50 * i + 20, 42, 17, 71); scrollbars[i].setValue(INITIAL_DEVIATION); final Integer index = new Integer(i); scrollbars[i].addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent evt) { evt.setSource(new Integer(index)); scrollBarAdjustmentValueChanged(evt); } }); } } // { // jScrollBar1 = new JScrollBar(); // getContentPane().add(jScrollBar1); // jScrollBar1.setBounds(20, 42, 17, 71); // jScrollBar1.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar1AdjustmentValueChanged(evt); // } // }); // } { for (int i = 0; i < cantBands; ++i) { bandLabels[i] = new JLabel(); getContentPane().add(bandLabels[i]); bandLabels[i].setText("Band " + i); bandLabels[i].setBounds(50 * i + 12, 23, 33, 14); } } // { // jLabel1 = new JLabel(); // getContentPane().add(jLabel1); // jLabel1.setText("Band 1"); // jLabel1.setBounds(12, 23, 33, 14); // } { signatureG = ChartFactory.createXYLineChart("Signature ", "Bands", "Valory", null, PlotOrientation.VERTICAL, true, true, false); chartpanel = new ChartPanel(signatureG); getContentPane().add(chartpanel); chartpanel.setBorder(BorderFactory.createTitledBorder("")); chartpanel.setBounds(20, 157, 45 * cantBands + 20, 210); } // { // jLabel2 = new JLabel(); // getContentPane().add(jLabel2); // jLabel2.setText("Band 2"); // jLabel2.setBounds(62, 23, 33, 14); // } // { // jScrollBar2 = new JScrollBar(); // getContentPane().add(jScrollBar2); // jScrollBar2.setBounds(70, 42, 17, 71); // jScrollBar2.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar2AdjustmentValueChanged(evt); // } // }); // } // { // jLabel3 = new JLabel(); // getContentPane().add(jLabel3); // jLabel3.setText("Band 3"); // jLabel3.setBounds(112, 23, 33, 14); // } // { // jScrollBar3 = new JScrollBar(); // getContentPane().add(jScrollBar3); // jScrollBar3.setBounds(120, 42, 17, 71); // jScrollBar3.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar3AdjustmentValueChanged(evt); // } // }); // } // { // jLabel4 = new JLabel(); // getContentPane().add(jLabel4); // jLabel4.setText("Band 4"); // jLabel4.setBounds(162, 23, 33, 14); // } // { // jScrollBar4 = new JScrollBar(); // getContentPane().add(jScrollBar4); // jScrollBar4.setBounds(170, 42, 17, 71); // jScrollBar4.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar4AdjustmentValueChanged(evt); // } // }); // } // { // jLabel5 = new JLabel(); // getContentPane().add(jLabel5); // jLabel5.setText("Band 5"); // jLabel5.setBounds(212, 23, 33, 14); // } // { // jScrollBar5 = new JScrollBar(); // getContentPane().add(jScrollBar5); // jScrollBar5.setBounds(220, 42, 17, 71); // jScrollBar5.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar5AdjustmentValueChanged(evt); // } // }); // } // { // jLabel6 = new JLabel(); // getContentPane().add(jLabel6); // jLabel6.setText("Band 6"); // jLabel6.setBounds(262, 23, 33, 14); // } // { // jScrollBar6 = new JScrollBar(); // getContentPane().add(jScrollBar6); // jScrollBar6.setBounds(270, 42, 17, 71); // jScrollBar6.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar6AdjustmentValueChanged(evt); // } // }); // } // { // jLabel7 = new JLabel(); // getContentPane().add(jLabel7); // jLabel7.setText("Band 7"); // jLabel7.setBounds(312, 23, 33, 14); // } // { // jScrollBar7 = new JScrollBar(); // getContentPane().add(jScrollBar7); // jScrollBar7.setBounds(320, 42, 17, 71); // jScrollBar7.addAdjustmentListener(new AdjustmentListener() { // public void adjustmentValueChanged(AdjustmentEvent evt) { // jScrollBar7AdjustmentValueChanged(evt); // } // }); // } { for (int i = 0; i < cantBands; ++i) { valueLabels[i] = new JLabel(); getContentPane().add(valueLabels[i]); valueLabels[i].setText(String.valueOf(INITIAL_DEVIATION)); valueLabels[i].setBounds(50 * i + 20, 119, 33, 19); } } // { // jLabel8 = new JLabel(); // getContentPane().add(jLabel8); // jLabel8.setBounds(20, 119, 33, 19); // jLabel8.setText("0"); // } // { // jLabel9 = new JLabel(); // getContentPane().add(jLabel9); // jLabel9.setText("0"); // jLabel9.setBounds(70, 119, 33, 19); // } // { // jLabel10 = new JLabel(); // getContentPane().add(jLabel10); // jLabel10.setText("0"); // jLabel10.setBounds(120, 119, 33, 19); // } // { // jLabel11 = new JLabel(); // getContentPane().add(jLabel11); // jLabel11.setText("0"); // jLabel11.setBounds(170, 119, 33, 19); // } // { // jLabel12 = new JLabel(); // getContentPane().add(jLabel12); // jLabel12.setText("0"); // jLabel12.setBounds(220, 119, 33, 19); // } // { // jLabel13 = new JLabel(); // getContentPane().add(jLabel13); // jLabel13.setText("0"); // jLabel13.setBounds(270, 119, 33, 19); // } // { // jLabel14 = new JLabel(); // getContentPane().add(jLabel14); // jLabel14.setText("0"); // jLabel14.setBounds(320, 119, 33, 19); // } { btCancel = new JButton(); getContentPane().add(btCancel); btCancel.setText("Cancel"); btCancel.setBounds(51 * cantBands - 75, 379, 75, 25); btCancel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { btCancelMouseClicked(evt); } }); } { btOk = new JButton(); getContentPane().add(btOk); btOk.setText("Generate"); btOk.setBounds(51 * cantBands - 155, 379, 75, 25); btOk.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { btOkMouseClicked(evt); } }); } } this.setSize(51 * cantBands + 40, 457); this.setResizable(false); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.mirth.connect.client.ui.dependencies.ChannelDependenciesPanel.java
private void initComponents() { setBackground(UIConstants.BACKGROUND_COLOR); dependencyLabel = new JLabel("This channel depends upon:"); dependencyTreeTable = new MirthTreeTable(); DefaultTreeTableModel dependencyModel = new SortableTreeTableModel(); DefaultMutableTreeTableNode dependencyRootNode = new DefaultMutableTreeTableNode(); dependencyModel.setRoot(dependencyRootNode); dependencyTreeTable.setTreeTableModel(dependencyModel); dependencyTreeTable.setRootVisible(false); dependencyTreeTable.setDoubleBuffered(true); dependencyTreeTable.setDragEnabled(false); dependencyTreeTable.setRowSelectionAllowed(true); dependencyTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dependencyTreeTable.setRowHeight(UIConstants.ROW_HEIGHT); dependencyTreeTable.setFocusable(true); dependencyTreeTable.setOpaque(true); dependencyTreeTable.setEditable(false); dependencyTreeTable.setSortable(true); dependencyTreeTable.putClientProperty("JTree.lineStyle", "Horizontal"); dependencyTreeTable.setAutoCreateColumnsFromModel(false); dependencyTreeTable.setShowGrid(true, true); dependencyTreeTable.setTableHeader(null); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { dependencyTreeTable.setHighlighters(HighlighterFactory .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); }/*from ww w . ja va 2 s .c o m*/ dependencyTreeTable.setTreeCellRenderer(new DependencyTreeCellRenderer(dependencyTreeTable)); dependencyTreeTable.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent evt) { checkSelection(evt); } @Override public void mouseReleased(MouseEvent evt) { checkSelection(evt); } private void checkSelection(MouseEvent evt) { if (dependencyTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) { dependencyTreeTable.clearSelection(); } } }); dependencyTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { boolean removeEnabled = false; int[] rows = dependencyTreeTable.getSelectedModelRows(); if (rows.length == 1) { TreePath selectedPath = dependencyTreeTable.getPathForRow(rows[0]); if (selectedPath != null) { if (selectedPath.getPathCount() == 2) { removeEnabled = true; } } } dependencyRemoveButton.setEnabled(removeEnabled); } } }); dependencyScrollPane = new JScrollPane(dependencyTreeTable); dependencyExpandAllLabel = new JLabel("<html><u>Expand All</u></html>"); dependencyExpandAllLabel.setForeground(Color.BLUE); dependencyExpandAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dependencyExpandAllLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent evt) { dependencyTreeTable.expandAll(); } }); dependencyCollapseAllLabel = new JLabel("<html><u>Collapse All</u></html>"); dependencyCollapseAllLabel.setForeground(Color.BLUE); dependencyCollapseAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dependencyCollapseAllLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent evt) { dependencyTreeTable.collapseAll(); } }); dependencyAddButton = new JButton("Add"); dependencyAddButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { Map<String, String> allowedChannelsMap = getAllowedChannels(true); if (MapUtils.isNotEmpty(allowedChannelsMap)) { AddDialog dialog = new AddDialog(allowedChannelsMap, true); if (dialog.wasSaved()) { for (String dependencyId : dialog.getSelectedChannelIds()) { dependencies.add(new ChannelDependency(channel.getId(), dependencyId)); } updateTreeTable(true, dependencies); updateAddButton(); } } } }); dependencyRemoveButton = new JButton("Remove"); dependencyRemoveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { int[] rows = dependencyTreeTable.getSelectedModelRows(); if (rows.length == 1) { TreePath selectedPath = dependencyTreeTable.getPathForRow(rows[0]); if (selectedPath != null && selectedPath.getPathCount() == 2) { Pair<String, String> pair = (Pair<String, String>) ((MutableTreeTableNode) selectedPath .getLastPathComponent()).getUserObject(); for (Iterator<ChannelDependency> it = dependencies.iterator(); it.hasNext();) { ChannelDependency dependency = it.next(); if (StringUtils.equals(channel.getId(), dependency.getDependentId()) && StringUtils.equals(pair.getLeft(), dependency.getDependencyId())) { it.remove(); } } updateTreeTable(true, dependencies); updateAddButton(); } } } }); dependencyRemoveButton.setEnabled(false); dependentLabel = new JLabel("This channel is depended upon by:"); dependentTreeTable = new MirthTreeTable(); DefaultTreeTableModel dependentModel = new SortableTreeTableModel(); DefaultMutableTreeTableNode dependentRootNode = new DefaultMutableTreeTableNode(); dependentModel.setRoot(dependentRootNode); dependentTreeTable.setTreeTableModel(dependentModel); dependentTreeTable.setRootVisible(false); dependentTreeTable.setDoubleBuffered(true); dependentTreeTable.setDragEnabled(false); dependentTreeTable.setRowSelectionAllowed(true); dependentTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dependentTreeTable.setRowHeight(UIConstants.ROW_HEIGHT); dependentTreeTable.setFocusable(true); dependentTreeTable.setOpaque(true); dependentTreeTable.setEditable(false); dependentTreeTable.setSortable(true); dependentTreeTable.putClientProperty("JTree.lineStyle", "Horizontal"); dependentTreeTable.setAutoCreateColumnsFromModel(false); dependentTreeTable.setShowGrid(true, true); dependentTreeTable.setTableHeader(null); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { dependentTreeTable.setHighlighters(HighlighterFactory .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } dependentTreeTable.setTreeCellRenderer(new DependencyTreeCellRenderer(dependentTreeTable)); dependentTreeTable.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent evt) { checkSelection(evt); } @Override public void mouseReleased(MouseEvent evt) { checkSelection(evt); } private void checkSelection(MouseEvent evt) { if (dependentTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) { dependentTreeTable.clearSelection(); } } }); dependentTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { boolean removeEnabled = false; int[] rows = dependentTreeTable.getSelectedModelRows(); if (rows.length == 1) { TreePath selectedPath = dependentTreeTable.getPathForRow(rows[0]); if (selectedPath != null) { if (selectedPath.getPathCount() == 2) { removeEnabled = true; } } } dependentRemoveButton.setEnabled(removeEnabled); } } }); dependentScrollPane = new JScrollPane(dependentTreeTable); dependentExpandAllLabel = new JLabel("<html><u>Expand All</u></html>"); dependentExpandAllLabel.setForeground(Color.BLUE); dependentExpandAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dependentExpandAllLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent evt) { dependentTreeTable.expandAll(); } }); dependentCollapseAllLabel = new JLabel("<html><u>Collapse All</u></html>"); dependentCollapseAllLabel.setForeground(Color.BLUE); dependentCollapseAllLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dependentCollapseAllLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent evt) { dependentTreeTable.collapseAll(); } }); dependentAddButton = new JButton("Add"); dependentAddButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { Map<String, String> allowedChannelsMap = getAllowedChannels(false); if (MapUtils.isNotEmpty(allowedChannelsMap)) { AddDialog dialog = new AddDialog(allowedChannelsMap, false); if (dialog.wasSaved()) { for (String dependentId : dialog.getSelectedChannelIds()) { dependencies.add(new ChannelDependency(dependentId, channel.getId())); } updateTreeTable(false, dependencies); updateAddButton(); } } } }); dependentRemoveButton = new JButton("Remove"); dependentRemoveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { int[] rows = dependentTreeTable.getSelectedModelRows(); if (rows.length == 1) { TreePath selectedPath = dependentTreeTable.getPathForRow(rows[0]); if (selectedPath != null && selectedPath.getPathCount() == 2) { Pair<String, String> pair = (Pair<String, String>) ((MutableTreeTableNode) selectedPath .getLastPathComponent()).getUserObject(); for (Iterator<ChannelDependency> it = dependencies.iterator(); it.hasNext();) { ChannelDependency dependency = it.next(); if (StringUtils.equals(pair.getLeft(), dependency.getDependentId()) && StringUtils.equals(channel.getId(), dependency.getDependencyId())) { it.remove(); } } updateTreeTable(false, dependencies); updateAddButton(); } } } }); dependentRemoveButton.setEnabled(false); }
From source file:com.neurotec.samples.panels.EnrollFromScanner.java
@Override protected void initGUI() { panelMain = new JPanel(); panelScanners = new JPanel(); scrollPaneList = new JScrollPane(); scannerList = new JList(); panelButtons = new JPanel(); btnRefresh = new JButton(); btnScan = new JButton(); btnCancel = new JButton(); btnForce = new JButton(); cbAutomatic = new JCheckBox(); scrollPane = new JScrollPane(); panelSouth = new JPanel(); panelInfo = new JPanel(); lblInfo = new JLabel(); panelSave = new JPanel(); btnIdentifyPatient = new JButton(); btnRegisterPatient = new JButton(); cbShowProcessed = new JCheckBox(); setLayout(new BorderLayout()); panelMain.setLayout(new BorderLayout()); panelScanners.setBorder(BorderFactory.createTitledBorder("Scanners list")); panelScanners.setLayout(new BorderLayout()); scrollPaneList.setPreferredSize(new Dimension(0, 90)); scannerList.setModel(new DefaultListModel()); scannerList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scannerList.setBorder(LineBorder.createBlackLineBorder()); scrollPaneList.setViewportView(scannerList); panelScanners.add(scrollPaneList, BorderLayout.CENTER); panelButtons.setLayout(new FlowLayout(FlowLayout.LEADING)); btnRefresh.setText("Refresh list"); panelButtons.add(btnRefresh);//from w ww . j av a2 s . co m btnScan.setText("Scan"); panelButtons.add(btnScan); btnCancel.setText("Cancel"); btnCancel.setEnabled(false); panelButtons.add(btnCancel); btnForce.setText("Force"); panelButtons.add(btnForce); cbAutomatic.setSelected(true); cbAutomatic.setText("Scan automatically"); panelButtons.add(cbAutomatic); panelScanners.add(panelButtons, BorderLayout.SOUTH); panelMain.add(panelScanners, BorderLayout.NORTH); panelMain.add(scrollPane, BorderLayout.CENTER); panelSouth.setLayout(new BorderLayout()); panelInfo.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); panelInfo.setLayout(new GridLayout(1, 1)); lblInfo.setText(" "); panelInfo.add(lblInfo); panelSouth.add(panelInfo, BorderLayout.NORTH); panelSave.setLayout(new FlowLayout(FlowLayout.LEADING)); btnIdentifyPatient.setText("Identify Patient"); btnIdentifyPatient.setEnabled(false); panelSave.add(btnIdentifyPatient); btnRegisterPatient.setText("Register Patient"); btnRegisterPatient.setEnabled(false); panelSave.add(btnRegisterPatient); cbShowProcessed.setSelected(true); cbShowProcessed.setText("Show processed image"); panelSave.add(cbShowProcessed); panelSouth.add(panelSave, BorderLayout.SOUTH); panelMain.add(panelSouth, BorderLayout.SOUTH); add(panelMain, BorderLayout.CENTER); panelLicensing = new LicensingPanel(requiredLicenses, optionalLicenses); add(panelLicensing, java.awt.BorderLayout.NORTH); fcImage = new JFileChooser(); fcImage.setFileFilter(new Utils.ImageFileFilter(NImages.getSaveFileFilter())); fcTemplate = new JFileChooser(); view = new NFingerView(); view.setShownImage(ShownImage.RESULT); view.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent ev) { super.mouseClicked(ev); if (ev.getButton() == MouseEvent.BUTTON3) { cbShowProcessed.doClick(); } } }); scrollPane.setViewportView(view); btnRefresh.addActionListener(this); btnScan.addActionListener(this); btnCancel.addActionListener(this); btnForce.addActionListener(this); btnIdentifyPatient.addActionListener(this); btnRegisterPatient.addActionListener(this); cbShowProcessed.addActionListener(this); scannerList.addListSelectionListener(new ScannerSelectionListener()); }
From source file:com.orthancserver.SelectImageDialog.java
public SelectImageDialog() { tree_ = new JTree(); tree_.addTreeWillExpandListener(new TreeWillExpandListener() { @Override//from w ww .j av a2s . c om public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { TreePath path = event.getPath(); if (path.getLastPathComponent() instanceof MyTreeNode) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); node.LoadChildren((DefaultTreeModel) tree_.getModel()); } } @Override public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException { } }); tree_.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { TreePath path = e.getNewLeadSelectionPath(); if (path != null) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); if (node.UpdatePreview(preview_)) { selectedType_ = node.GetResourceType(); selectedUuid_ = node.GetUuid(); selectedConnection_ = node.GetConnection(); okButton_.setEnabled(true); } removeServer_.setEnabled(node.GetResourceType() == ResourceType.SERVER); } } }); tree_.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { TreePath path = tree_.getPathForLocation(e.getX(), e.getY()); if (path != null) { MyTreeNode node = (MyTreeNode) path.getLastPathComponent(); if (e.getClickCount() == 2 && node.GetResourceType() == ResourceType.INSTANCE) { // Double click on an instance, close the dialog isSuccess_ = true; setVisible(false); } } } }); final JPanel contentPanel = new JPanel(); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JSplitPane splitPane = new JSplitPane(); splitPane.setResizeWeight(0.6); contentPanel.add(splitPane); splitPane.setLeftComponent(new JScrollPane(tree_)); splitPane.setRightComponent(preview_); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton btnAddServer = new JButton("Add server"); btnAddServer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { OrthancConfigurationDialog dd = new OrthancConfigurationDialog(); dd.setLocationRelativeTo(null); // Center dialog on screen OrthancConnection orthanc = dd.ShowModal(); if (orthanc != null) { AddOrthancServer(orthanc); ((DefaultTreeModel) tree_.getModel()).reload(); } } }); buttonPane.add(btnAddServer); } { buttonPane.add(removeServer_); removeServer_.setEnabled(false); removeServer_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { MyTreeNode selected = (MyTreeNode) tree_.getLastSelectedPathComponent(); if (selected.GetResourceType() == ResourceType.SERVER && JOptionPane.showConfirmDialog(null, "Remove server \"" + selected.getUserObject() + "\"?", "WARNING", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { ((DefaultTreeModel) tree_.getModel()).removeNodeFromParent(selected); } } }); } { okButton_.setEnabled(false); okButton_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { isSuccess_ = true; setVisible(false); } }); buttonPane.add(okButton_); getRootPane().setDefaultButton(okButton_); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg) { setVisible(false); } }); buttonPane.add(cancelButton); } } setUndecorated(false); setSize(500, 500); setTitle("Select some series or some instance in Orthanc"); setModal(true); }
From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java
/** * Creates a new {@link AttributeStatisticsPanel} instance. Before displaying the panel, an * {@link AbstractAttributeStatisticsModel} should be set via * {@link #setModel(AbstractAttributeStatisticsModel, boolean)}. * *//*from ww w . j a v a 2 s . c o m*/ public AttributeStatisticsPanel() { listOfChartPanels = new LinkedList<>(); // create listener which listens for hovering/enlarge mouse events on this panel enlargeAndHoverAndPopupMouseAdapter = new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { // only popup trigger for popup menu if (e.isPopupTrigger()) { handlePopup(e); } // only left mouse button to enlarge if (!SwingUtilities.isLeftMouseButton(e)) { return; } // little hack so hovering over the details button does not remove the hover effect // (because MouseExited is called) // but clicking the button is still possible and does not enlarge the panel if (e.getSource() instanceof JButton) { ((JButton) e.getSource()).doClick(); return; } // change enlarged status if (getModel() != null) { getModel().setEnlarged(!getModel().isEnlarged()); } } @Override public void mouseExited(final MouseEvent e) { if (SwingTools.isMouseEventExitedToChildComponents(AttributeStatisticsPanel.this, e)) { // we are still hovering over the ASP, just a child component return; } hovered = false; repaint(); } @Override public void mouseEntered(final MouseEvent e) { hovered = true; repaint(); } @Override public void mouseReleased(final MouseEvent e) { if (e.isPopupTrigger()) { handlePopup(e); } } /** * Handles the popup click event. * * @param e */ private void handlePopup(final MouseEvent e) { if (model.getAttribute().isNumerical()) { popupAttributeNumericalStatPanel.show(e.getComponent(), e.getX(), e.getY()); } else if (model.getAttribute().isNominal()) { popupAttributeNominalStatPanel.show(e.getComponent(), e.getX(), e.getY()); } else if (model.getAttribute().isDateTime()) { popupAttributeDateTimeStatPanel.show(e.getComponent(), e.getX(), e.getY()); } } }; // create listener which listens for AttributeStatisticsEvents on the model listener = new AttributeStatisticsEventListener() { @Override public void modelChanged(final AttributeStatisticsEvent e) { switch (e.getEventType()) { case ALTERNATING_CHANGED: repaint(); break; case ENLARGED_CHANGED: updateCharts(); updateVisibilityOfChartPanels(); if (AttributeStatisticsPanel.this.model.getAttribute().isNominal()) { displayNominalValues(); } break; case SHOW_CONSTRUCTION_CHANGED: panelStatsConstruction.setVisible(model.isShowConstruction()); break; case STATISTICS_CHANGED: SwingUtilities.invokeLater(new Runnable() { @Override public void run() { AbstractAttributeStatisticsModel model = AttributeStatisticsPanel.this.model; if (model.getAttribute().isNumerical()) { updateNumericalElements(model); } else if (model.getAttribute().isNominal()) { updateNominalElements(model); } else { updateDateTimeElements(model); } } }); break; default: } } }; initGUI(); }
From source file:com.projity.pm.graphic.spreadsheet.SpreadSheet.java
public void setModel(SpreadSheetModel spreadSheetModel, SpreadSheetColumnModel spreadSheetColumnModel) { makeCustomTableHeader(spreadSheetColumnModel); TableModel oldModel = getModel(); setModel(spreadSheetModel);//w w w .j a v a 2s .c o m if (spreadSheetColumnModel != null) { //System.out.println("creating new ColModel"); setColumnModel(spreadSheetColumnModel); selection = new SpreadSheetSelectionModel(this); selection.setRowSelection(new SpreadSheetListSelectionModel(selection, true)); selection.setColumnSelection(new SpreadSheetListSelectionModel(selection, false)); setSelectionModel(selection.getRowSelection()); createDefaultColumnsFromModel(spreadSheetModel.getFieldArray()); //Consume memory getColumnModel().setSelectionModel(selection.getColumnSelection()); } registerEditors(); //Consume memory initRowHeader(spreadSheetModel); initModel(); initListeners(); GraphicConfiguration config = GraphicConfiguration.getInstance(); //fix for substance setTableHeader(createDefaultTableHeader()); JTableHeader header = getTableHeader(); header.setPreferredSize( new Dimension((int) header.getPreferredSize().getWidth(), config.getColumnHeaderHeight())); header.addMouseListener(new HeaderMouseListener(this)); addMouseListener(new MouseAdapter() { // Cursor oldCursor = null; // public void mouseEntered(MouseEvent e) { // Point p = e.getPoint(); // int col = columnAtPoint(p); // Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1); // System.out.println("mouse entered field " + field); // if (field != null && field.isHyperlink()) { // oldCursor = getCursor(); // setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); // System.out.println("setting new cursor to " + Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + " old is " + oldCursor); // } else // super.mouseEntered(e); // // } // // public void mouseExited(MouseEvent e) { // Point p = e.getPoint(); // int col = columnAtPoint(p); // Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1); // System.out.println("mouse exited field " + field); // if (field != null && field.isHyperlink()) { // setCursor(oldCursor); // System.out.println("setting old cursor to " + oldCursor); // e.consume(); // } else // super.mouseEntered(e); // } public void mousePressed(MouseEvent e) { // changed to mousePressed instead of mouseClicked() for snappier handling 17/5/04 hk Point p = e.getPoint(); int row = rowAtPoint(p); int col = columnAtPoint(p); SpreadSheetPopupMenu popup = getPopup(); if (SwingUtilities.isLeftMouseButton(e)) { SpreadSheetColumnModel columnModel = (SpreadSheetColumnModel) getColumnModel(); Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1); SpreadSheetModel model = (SpreadSheetModel) getModel(); if (field.isNameField()) { // if (col == columnModel.getNameIndex()) { GraphicNode node = model.getNode(row); if (isOnIcon(e)) { if (model.getCellProperties(node).isCompositeIcon()) { finishCurrentOperations(); selection.getRowSelection().clearSelection(); boolean change = true; if (!node.isFetched()) // for subprojects change = node.fetch(); if (change) model.changeCollapsedState(row); e.consume(); // prevent dbl click treatment below // because editor may have already been // installed we // have to update its collapsed state // updateNameCellEditor(node); // editCellAt(row,model.findGraphicNodeRow(node)); } } } else if (field != null && field.isHyperlink()) { Hyperlink link = (Hyperlink) model.getValueAt(row, col + 1); if (link != null) { BrowserControl.displayURL(link.getAddress()); e.consume(); // prevent dbl click treatment below } } if (!e.isConsumed()) { if (e.getClickCount() == 2) // if above code didn't treat and is dbl click doDoubleClick(row, col); else doClick(row, col); } } else if (popup != null && SwingUtilities.isRightMouseButton(e)) { // e.isPopupTrigger() can be used too // selection.getRowSelection().clearSelection(); // selection.getRowSelection().addSelectionInterval(row, row); popup.setRow(row); popup.setCol(col); popup.show(SpreadSheet.this, e.getX(), e.getY()); } } }); if (oldModel != spreadSheetModel && oldModel instanceof CommonSpreadSheetModel) ((CommonSpreadSheetModel) getModel()).getCache().removeNodeModelListener(this); spreadSheetModel.getCache().addNodeModelListener(this); // getColumnModel().addColumnModelListener(new TableColumnModelListener(){ // public void columnAdded(TableColumnModelEvent e) { // // TODO Auto-generated method stub // // } // public void columnMarginChanged(ChangeEvent e) { // // TODO Auto-generated method stub // // } // public void columnMoved(TableColumnModelEvent e) { // // TODO Auto-generated method stub // // } // public void columnRemoved(TableColumnModelEvent e) { // // TODO Auto-generated method stub // // } // public void columnSelectionChanged(ListSelectionEvent e) { // System.out.println(((e.getValueIsAdjusting())?"lse=":"LSE=")+e.getFirstIndex()+", "+e.getLastIndex()); // SpreadSheet.this.revalidate(); // //SpreadSheet.this.paintImmediately(0, 0, getWidth(), GraphicConfiguration.getInstance().getColumnHeaderHeight()); // } // }); }
From source file:com.sshtools.common.ui.SshToolsApplication.java
/** * Show an 'About' dialog//from ww w. j av a2 s. c o m * * */ public void showAbout(final Component parent) { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); GridBagConstraints gBC = new GridBagConstraints(); gBC.anchor = GridBagConstraints.CENTER; gBC.fill = GridBagConstraints.HORIZONTAL; gBC.insets = new Insets(1, 1, 1, 1); JLabel a = new JLabel(getApplicationName()); a.setFont(a.getFont().deriveFont(24f)); UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER); MultilineLabel v = new MultilineLabel(getApplicationName() + " " + getApplicationVersion()); v.setFont(v.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER); MultilineLabel x = new MultilineLabel(getAboutAuthors()); x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0)); x.setFont(x.getFont().deriveFont(12f)); UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER); MultilineLabel c = new MultilineLabel(getAboutLicenseDetails()); c.setFont(c.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER); final JLabel h = new JLabel(getAboutURL()); h.setForeground(Color.blue); h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10)); h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); h.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { try { BrowserLauncher.openURL(getAboutURL()); } catch (IOException ioe) { ioe.printStackTrace(); } } }); UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER); JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon()); }
From source file:Classes.MainForm.java
private void initMainForm() throws IOException {//create sally form switch (getPrayerTimesHandler().getActualPrayerTime()) {//set background case 0://from w w w . ja va 2s.c om this.backgroundImage = new ImageIcon(getClass().getResource(duhrBackground)).getImage(); break; case 1: this.backgroundImage = new ImageIcon(getClass().getResource(shorou9Background)).getImage(); break; case 2: this.backgroundImage = new ImageIcon(getClass().getResource(fajrBackground)).getImage(); break; case 3: this.backgroundImage = new ImageIcon(getClass().getResource(ishaaBackground)).getImage(); break; case 4: this.backgroundImage = new ImageIcon(getClass().getResource(maghribBackground)).getImage(); break; case 5: this.backgroundImage = new ImageIcon(getClass().getResource(asrBackground)).getImage(); break; default: this.backgroundImage = new ImageIcon(getClass().getResource(shorou9Background)).getImage(); break; } this.mainFrame = new JFrame(); this.mainPanel = new MainImagePanel(getBackgroundImage(), prayerTimesHandler.getActualPrayerTime()); this.mainPanel.setLayout(null); this.font = new Font("TimesRoman", Font.ITALIC, 15); this.locationFont = new Font("TimesRoman", Font.ITALIC, 22); this.digitalClockfont = new Font("TimesRoman", Font.ROMAN_BASELINE, 20); this.fontMiladiHijriTimes = new Font("TimesRoman", Font.ROMAN_BASELINE, 13); this.fontNextPrayer = new Font("TimesRoman", Font.ROMAN_BASELINE, 20); this.exitLabel = new JLabel(); this.hijriTime = new JLabel("", SwingConstants.RIGHT); this.miladiTime = new JLabel(); this.location = new JLabel(locationValue); this.location.setHorizontalAlignment(SwingConstants.CENTER); this.locationFromInternet = new JLabel(); //get all translated salat names this.fajrName = new JLabel(PropertiesHandler.getSingleton().getValue(1020)); this.fajrName.setHorizontalAlignment(SwingConstants.CENTER); this.fajrTime = new JLabel(); this.fajrTime.setHorizontalAlignment(SwingConstants.CENTER); this.shorou9Name = new JLabel(PropertiesHandler.getSingleton().getValue(1021)); this.shorou9Name.setHorizontalAlignment(SwingConstants.CENTER); this.shorou9Time = new JLabel(); this.shorou9Time.setHorizontalAlignment(SwingConstants.CENTER); this.duhrName = new JLabel(PropertiesHandler.getSingleton().getValue(1022)); this.duhrName.setHorizontalAlignment(SwingConstants.CENTER); this.duhrTime = new JLabel(); this.duhrTime.setHorizontalAlignment(SwingConstants.CENTER); this.asrName = new JLabel(PropertiesHandler.getSingleton().getValue(1023)); this.asrName.setHorizontalAlignment(SwingConstants.CENTER); this.asrTime = new JLabel(); this.asrTime.setHorizontalAlignment(SwingConstants.CENTER); this.maghribName = new JLabel(PropertiesHandler.getSingleton().getValue(1024)); this.maghribName.setHorizontalAlignment(SwingConstants.CENTER); this.maghribTime = new JLabel(); this.maghribTime.setHorizontalAlignment(SwingConstants.CENTER); this.ishaaName = new JLabel(PropertiesHandler.getSingleton().getValue(1025)); this.ishaaName.setHorizontalAlignment(SwingConstants.CENTER); this.ishaaTime = new JLabel(); this.ishaaTime.setHorizontalAlignment(SwingConstants.CENTER); this.digitalClock = new JLabel(); this.nextPrayer = new JLabel(); this.settings = new JLabel(); this.exitLabel.setIcon(exitIcon); this.settings.setIcon(settingsIcon); this.locationFromInternet.setIcon(locationfromInternetIconMain); this.nextDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(nextDayPrayerTimesIcon))); this.previousDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(previousDayPrayerTimesIcon))); this.actualDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(actualDayPrayerTimesIcon))); this.previousDayPrayerTimes.setBounds(480, 275, 15, 15); this.actualDayPrayerTimes.setBounds(500, 275, 15, 15); this.nextDayPrayerTimes.setBounds(520, 275, 15, 15); this.nextDayPrayerTimes.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { nextPreviousDay++; Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, nextPreviousDay); try { PrayersTimes prayerTimes = new PrayersTimes(cal); MiladiTime miladiTime = new MiladiTime(cal); HijriTime hijriTime = new HijriTime(cal); setAllLabelsTimesHijriMiladiValues2(prayerTimes, hijriTime, miladiTime); } catch (IOException e1) { } } }); this.previousDayPrayerTimes.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { nextPreviousDay--; Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, nextPreviousDay); try { PrayersTimes prayerTimes = new PrayersTimes(cal); MiladiTime miladiTime = new MiladiTime(cal); HijriTime hijriTime = new HijriTime(cal); setAllLabelsTimesHijriMiladiValues2(prayerTimes, hijriTime, miladiTime); } catch (IOException e1) { } } }); this.actualDayPrayerTimes.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { nextPreviousDay = 0; setAllLabelsTimesHijriMiladiValues(prayersTimes, hijriTimeObj, miladiTimeObj); } catch (IOException e1) { } //set all values to all labels } }); //set foreground color to all salat names and times this.duhrName.setForeground(Color.WHITE); this.shorou9Name.setForeground(Color.WHITE); this.fajrName.setForeground(Color.WHITE); this.ishaaName.setForeground(Color.WHITE); this.maghribName.setForeground(Color.WHITE); this.asrName.setForeground(Color.WHITE); this.duhrTime.setForeground(Color.WHITE); this.shorou9Time.setForeground(Color.WHITE); this.fajrTime.setForeground(Color.WHITE); this.ishaaTime.setForeground(Color.WHITE); this.maghribTime.setForeground(Color.WHITE); this.asrTime.setForeground(Color.WHITE); this.miladiTime.setForeground(Color.WHITE); this.hijriTime.setForeground(Color.WHITE); this.location.setForeground(Color.WHITE); this.digitalClock.setForeground(Color.WHITE); this.nextPrayer.setForeground(Color.WHITE); //set font to all salat names and times this.duhrName.setFont(font); this.shorou9Name.setFont(font); this.fajrName.setFont(font); this.ishaaName.setFont(font); this.maghribName.setFont(font); this.asrName.setFont(font); this.duhrTime.setFont(font); this.shorou9Time.setFont(font); this.fajrTime.setFont(font); this.ishaaTime.setFont(font); this.maghribTime.setFont(font); this.asrTime.setFont(font); this.digitalClock.setFont(digitalClockfont); this.nextPrayer.setFont(fontNextPrayer); this.miladiTime.setFont(fontMiladiHijriTimes); this.hijriTime.setFont(fontMiladiHijriTimes); this.location.setFont(locationFont); //set position color to all salat names and times this.exitLabel.setBounds(510, 0, 40, 40); if (UserConfig.getSingleton().getLanguage().equalsIgnoreCase(ar)) { this.hijriTime.setBounds(100, 3, 250, 20); this.miladiTime.setBounds(20, 3, 250, 20); } else { this.hijriTime.setBounds(150, 3, 250, 20); this.miladiTime.setBounds(5, 3, 250, 20); } this.location.setBounds(0, 40, 550, 30); this.donateLabel = new JLabel(PropertiesHandler.getSingleton().getValue(1106)); this.donateLabel.setFont(fontMiladiHijriTimes); this.donateLabel.setBounds(420, 3, 50, 20); this.donateLabel.setForeground(Color.WHITE); this.donateLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FJDAFTPKN2S2W"; String os = System.getProperty("os.name").toLowerCase(); Runtime rt = Runtime.getRuntime(); try { if (os.indexOf("win") >= 0) { // this doesn't support showing urls in the form of "page.html#nameLink" rt.exec("rundll32 url.dll,FileProtocolHandler " + url); } else if (os.indexOf("mac") >= 0) { rt.exec("open " + url); } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) { // Do a best guess on unix until we get a platform independent way // Build a list of browsers to try, in this order. String[] browsers = { "epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera", "links", "lynx" }; // Build a command string which looks like "browser1 "url" || browser2 "url" ||..." StringBuffer cmd = new StringBuffer(); for (int i = 0; i < browsers.length; i++) cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" + url + "\" "); rt.exec(new String[] { "sh", "-c", cmd.toString() }); } else { } } catch (Exception ex) { } } }); this.locationFromInternet.setBounds(260, 70, 20, 20); this.locationFromInternet.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { new Thread(new Runnable() { @Override public void run() { if (locationFromInternet.isEnabled()) { locationFromInternet.setEnabled(false); locationFromInternet.setIcon(loaderMain); locationFromInternetLabelMouseClicked(e); } } }).start(); } }); this.fajrAthan = new JLabel(); this.fajrAthan.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { allAthanClickHandler(0); } catch (Exception e1) { } } }); this.shorou9Athan = new JLabel(); this.shorou9Athan.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { allAthanClickHandler(1); } catch (Exception e1) { } } }); this.duhrAthan = new JLabel(); this.duhrAthan.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { allAthanClickHandler(2); } catch (Exception e1) { } } }); this.asrAthan = new JLabel(); this.asrAthan.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { allAthanClickHandler(3); } catch (Exception e1) { } } }); this.maghribAthan = new JLabel(); this.maghribAthan.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { allAthanClickHandler(4); } catch (Exception e1) { } } }); this.ishaaAthan = new JLabel(); this.ishaaAthan.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { allAthanClickHandler(5); } catch (Exception e1) { } } }); this.duhrAthan.setBounds(152, 132, 28, 28); this.shorou9Athan.setBounds(322, 132, 28, 28); this.fajrAthan.setBounds(492, 132, 28, 28); this.ishaaAthan.setBounds(152, 212, 28, 28); this.maghribAthan.setBounds(322, 212, 28, 28); this.asrAthan.setBounds(492, 212, 28, 28); setAllAthanIcons(); this.duhrName.setBounds(30, 100, 150, 30); this.duhrTime.setBounds(30, 130, 150, 30); this.shorou9Name.setBounds(200, 100, 150, 30); this.shorou9Time.setBounds(200, 130, 150, 30); this.fajrName.setBounds(370, 100, 150, 30); this.fajrTime.setBounds(370, 130, 150, 30); this.ishaaName.setBounds(30, 180, 150, 30); this.ishaaTime.setBounds(30, 210, 150, 30); this.maghribName.setBounds(200, 180, 150, 30); this.maghribTime.setBounds(200, 210, 150, 30); this.asrName.setBounds(370, 180, 150, 30); this.asrTime.setBounds(370, 210, 150, 30); this.digitalClock.setBounds(10, 250, 200, 50); this.nextPrayer.setBounds(150, 262, 350, 30); this.settings.setBounds(470, 0, 40, 40); this.settings.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { settingsLabelMouseClicked(e); } }); this.exitLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { exitLabelMouseClicked(e); } }); this.mainFrame.addMouseMotionListener(new MouseAdapter() { @Override public void mouseDragged(MouseEvent e) { mainFrameMouseDragged(e); } }); this.mainFrame.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { mainFrameMousePressed(e); } }); this.mainFrame.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { mainFrameMouseReleased(e); } }); this.mainFrame.setSize(550, 300); this.mainFrame.setLocationRelativeTo(null); this.mainFrame.setUndecorated(true); this.mainFrame.setResizable(false); //adding all labels objects to main panel this.mainPanel.add(exitLabel); this.mainPanel.add(hijriTime); this.mainPanel.add(miladiTime); this.mainPanel.add(location); this.mainPanel.add(locationFromInternet); this.mainPanel.add(duhrName); this.mainPanel.add(duhrTime); this.mainPanel.add(shorou9Name); this.mainPanel.add(shorou9Time); this.mainPanel.add(fajrName); this.mainPanel.add(fajrTime); this.mainPanel.add(ishaaName); this.mainPanel.add(ishaaTime); this.mainPanel.add(maghribName); this.mainPanel.add(maghribTime); this.mainPanel.add(asrName); this.mainPanel.add(asrTime); this.mainPanel.add(digitalClock); this.mainPanel.add(nextPrayer); this.mainPanel.add(settings); this.mainPanel.add(donateLabel); this.mainPanel.add(fajrAthan); this.mainPanel.add(shorou9Athan); this.mainPanel.add(duhrAthan); this.mainPanel.add(asrAthan); this.mainPanel.add(maghribAthan); this.mainPanel.add(ishaaAthan); this.mainPanel.add(nextDayPrayerTimes); this.mainPanel.add(previousDayPrayerTimes); this.mainPanel.add(actualDayPrayerTimes); this.mainFrame.add(mainPanel); this.pack(); trayConfig();//create try icon this.setAllLabelsTimesHijriMiladiValues(prayersTimes, hijriTimeObj, miladiTimeObj);//set all values to all labels this.prayerTimesHandler.start();//start prayer times handler thread }