List of usage examples for java.awt Cursor HAND_CURSOR
int HAND_CURSOR
To view the source code for java.awt Cursor HAND_CURSOR.
Click Source Link
From source file:io.github.jeddict.jsonb.modeler.widget.JSONNodeWidget.java
protected void addOpenSourceCodeAction() { this.getImageWidget().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.getImageWidget().getActions().addAction(new OpenSourceCodeAction( () -> getFileObject(this.getBaseElementSpec().getAttribute().getJavaClass(), this.getModelerScene().getModelerFile().getParentFile()), this.getBaseElementSpec().getAttribute(), this.getModelerScene().getModelerFile().getParentFile())); }
From source file:org.gitools.ui.core.components.boxes.DetailsBox.java
private Component createNameLabel(DetailsDecoration detail) { if (detail instanceof JComponentDetailsDecoration) { Component c = createComponentNameLabel((JComponentDetailsDecoration) detail); if (c != null) { return c; }/*from www .j a v a2s .co m*/ } WebLabel label = new WebLabel(StringUtils.capitalize(detail.getName()), JLabel.TRAILING); label.setDrawShade(true); SwingUtils.changeFontSize(label, -1); if (detail.isSelected()) { SwingUtils.setBoldFont(label); } label.setCursor(new Cursor(Cursor.HAND_CURSOR)); label.addMouseListener(new PropertyMouseListener(detail)); if (StringUtils.isNotEmpty(detail.getDescription())) { String description = "<html><body width=\"300px\">" + detail.getDescription() + "</body></html>"; TooltipManager.setTooltip(label, description, TooltipWay.down, 0); } if (!StringUtils.isEmpty(detail.getDescriptionLink())) { DetailsWebLinkLabel webLabel = new DetailsWebLinkLabel("", JLabel.TRAILING); webLabel.setIcon(IconNames.INFO_ICON); webLabel.setLink(detail.getDescriptionLink(), false); TooltipManager.setTooltip(webLabel, detail.getDescriptionLink(), TooltipWay.down, 0); return new GroupPanel(GroupingType.fillFirst, 5, webLabel, label); } return label; }
From source file:org.rdv.ui.TimeSlider.java
/** * Creates a time slider with the maximum available range. *///from w w w . j a v a 2 s.c om public TimeSlider() { super(); minimum = 0; start = 0; value = 0; end = Double.MAX_VALUE; maximum = Double.MAX_VALUE; valueChangeable = true; rangeChangeable = true; isAdjusting = false; markers = new ArrayList<EventMarker>(); timeRanges = new ArrayList<TimeRange>(); actualTimeRanges = new ArrayList<TimeRange>(); calculateActualTimeRanges(); adjustmentListeners = new ArrayList<TimeAdjustmentListener>(); setBorder(null); setLayout(null); setToolTipText(""); addMouseListener(this); valueButton = new JButton(DataViewer.getIcon("icons/time.gif")) { /** serialization version identifier */ private static final long serialVersionUID = 8729851598067678522L; public JToolTip createToolTip() { return TimeSlider.this.createToolTip(); } public String getToolTipText(MouseEvent me) { return TimeSlider.this.getToolTipText(me); } }; valueButton.setToolTipText(""); valueButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); valueButton.setOpaque(false); valueButton.setBorder(null); valueButton.addMouseMotionListener(this); valueButton.addMouseListener(this); add(valueButton); startButton = new JButton(DataViewer.getIcon("icons/left_bound.gif")); startButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); startButton.setOpaque(false); startButton.setBorder(null); startButton.addMouseListener(this); startButton.addMouseMotionListener(this); add(startButton); endButton = new JButton(DataViewer.getIcon("icons/right_bound.gif")); endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); endButton.setOpaque(false); endButton.setBorder(null); endButton.addMouseListener(this); endButton.addMouseMotionListener(this); add(endButton); defaultMarkerImage = DataViewer.getImage("icons/marker.gif"); annotationMarkerImage = DataViewer.getImage("icons/marker-annotation.gif"); startMarkerImage = DataViewer.getImage("icons/marker-start.gif"); stopMarkerImage = DataViewer.getImage("icons/marker-stop.gif"); }
From source file:org.revager.tools.GUITools.java
/** * Creates a new image toggle button./* ww w .j a v a2 s . c o m*/ * * @return the newly created image toggle button */ public static JToggleButton newImageToggleButton() { JToggleButton button = new JToggleButton(); button.setBorder(new EmptyBorder(2, 2, 2, 8)); button.setMargin(new Insets(0, 0, 0, 0)); button.setBorderPainted(false); button.setOpaque(false); button.setContentAreaFilled(false); button.setFocusable(false); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return button; }
From source file:op.care.med.structure.DlgProduct.java
/** * This method is called from within the constructor to * initialize the form./* ww w . j ava 2s . c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc=" Erzeugter Quelltext ">//GEN-BEGIN:initComponents private void initComponents() { lblProductName = new JLabel(); txtName = new JTextField(); cmbAcme = new JComboBox<>(); lblAcme = new JLabel(); btnAdd = new JButton(); lblSideEffects = new JLabel(); scrollPane1 = new JScrollPane(); txtSideEffects = new JTextArea(); panel1 = new JPanel(); btnCancel = new JButton(); btnOK = new JButton(); //======== this ======== setModal(true); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("2*(default, $lcgap), default:grow, 2*($lcgap, default)", "default, 2*($lgap, fill:default), $lgap, fill:default:grow, $lgap, fill:default, $lgap, default")); //---- lblProductName ---- lblProductName.setText("Produktname"); lblProductName.setFont(new Font("Arial", Font.PLAIN, 14)); contentPane.add(lblProductName, CC.xy(3, 3)); //---- txtName ---- txtName.setFont(new Font("Arial", Font.PLAIN, 14)); contentPane.add(txtName, CC.xywh(5, 3, 3, 1)); //---- cmbAcme ---- cmbAcme.setModel( new DefaultComboBoxModel<>(new String[] { "Eintrag 1", "Eintrag 2", "Eintrag 3", "Eintrag 4" })); cmbAcme.setFont(new Font("Arial", Font.PLAIN, 14)); cmbAcme.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbAcmeItemStateChanged(e); } }); contentPane.add(cmbAcme, CC.xy(5, 5)); //---- lblAcme ---- lblAcme.setText("Hersteller"); lblAcme.setFont(new Font("Arial", Font.PLAIN, 14)); contentPane.add(lblAcme, CC.xy(3, 5)); //---- btnAdd ---- btnAdd.setText(null); btnAdd.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAdd.setContentAreaFilled(false); btnAdd.setBorder(null); btnAdd.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAdd.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnAddActionPerformed(e); } }); contentPane.add(btnAdd, CC.xy(7, 5, CC.LEFT, CC.DEFAULT)); //---- lblSideEffects ---- lblSideEffects.setText("Hersteller"); lblSideEffects.setFont(new Font("Arial", Font.PLAIN, 14)); contentPane.add(lblSideEffects, CC.xy(3, 7, CC.DEFAULT, CC.TOP)); //======== scrollPane1 ======== { //---- txtSideEffects ---- txtSideEffects.setFont(new Font("Arial", Font.PLAIN, 14)); scrollPane1.setViewportView(txtSideEffects); } contentPane.add(scrollPane1, CC.xywh(5, 7, 3, 1)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); //---- btnCancel ---- btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/16x16/cancel.png"))); btnCancel.setText(null); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCancelActionPerformed(e); } }); panel1.add(btnCancel); //---- btnOK ---- btnOK.setIcon(new ImageIcon(getClass().getResource("/artwork/16x16/apply.png"))); btnOK.setText(null); btnOK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnOKActionPerformed(e); } }); panel1.add(btnOK); } contentPane.add(panel1, CC.xywh(5, 9, 3, 1, CC.RIGHT, CC.DEFAULT)); setSize(585, 285); setLocationRelativeTo(null); }
From source file:org.rdv.ui.ExportDialog.java
private void initComponents(List<String> channels, List<String> fileFormats) { channelModel = new DefaultListModel(); for (int i = 0; i < channels.size(); i++) { String channelName = (String) channels.get(i); Channel channel = RBNBController.getInstance().getChannel(channelName); String mime = channel.getMetadata("mime"); if (mime.equals("application/octet-stream")) { channelModel.addElement(new ExportChannel(channelName)); }// ww w .j a v a2 s .c o m } JPanel container = new JPanel(); setContentPane(container); InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = container.getActionMap(); container.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weighty = 0; c.gridwidth = 1; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; JLabel headerLabel = new JLabel("Select the time range and data channels to export."); headerLabel.setBackground(Color.white); headerLabel.setOpaque(true); headerLabel.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray), BorderFactory.createEmptyBorder(10, 10, 10, 10))); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 0, 0, 0); container.add(headerLabel, c); JPanel timeButtonPanel = new JPanel(); timeButtonPanel.setLayout(new BorderLayout()); MouseListener hoverMouseListener = new MouseAdapter() { public void mouseEntered(MouseEvent e) { e.getComponent().setForeground(Color.red); } public void mouseExited(MouseEvent e) { e.getComponent().setForeground(Color.blue); } }; startTimeButton = new JButton(); startTimeButton.setBorder(null); startTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); startTimeButton.setForeground(Color.blue); startTimeButton.addMouseListener(hoverMouseListener); startTimeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { double startTime = DateTimeDialog.showDialog(ExportDialog.this, timeSlider.getStart(), timeSlider.getMinimum(), timeSlider.getEnd()); if (startTime >= 0) { timeSlider.setStart(startTime); } } }); timeButtonPanel.add(startTimeButton, BorderLayout.WEST); durationLabel = new JLabel(); durationLabel.setHorizontalAlignment(JLabel.CENTER); timeButtonPanel.add(durationLabel, BorderLayout.CENTER); endTimeButton = new JButton(); endTimeButton.setBorder(null); endTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); endTimeButton.setForeground(Color.blue); endTimeButton.addMouseListener(hoverMouseListener); endTimeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { double endTime = DateTimeDialog.showDialog(ExportDialog.this, timeSlider.getEnd(), timeSlider.getStart(), timeSlider.getMaximum()); if (endTime >= 0) { timeSlider.setEnd(endTime); } } }); timeButtonPanel.add(endTimeButton, BorderLayout.EAST); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(10, 10, 10, 10); container.add(timeButtonPanel, c); timeSlider = new TimeSlider(); timeSlider.setValueChangeable(false); timeSlider.setValueVisible(false); timeSlider.addTimeAdjustmentListener(new TimeAdjustmentListener() { public void timeChanged(TimeEvent event) { } public void rangeChanged(TimeEvent event) { updateTimeRangeLabel(); } public void boundsChanged(TimeEvent event) { } }); updateTimeRangeLabel(); updateTimeBounds(); List<EventMarker> markers = RBNBController.getInstance().getMarkerManager().getMarkers(); for (EventMarker marker : markers) { timeSlider.addMarker(marker); } c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(timeSlider, c); JLabel numericHeaderLabel = new JLabel("Data Channels:"); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 3; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(numericHeaderLabel, c); numericChannelList = new JList(channelModel); numericChannelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); numericChannelList.setCellRenderer(new CheckListRenderer()); numericChannelList.setVisibleRowCount(10); numericChannelList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int index = numericChannelList.locationToIndex(e.getPoint()); ExportChannel item = (ExportChannel) numericChannelList.getModel().getElementAt(index); item.setSelected(!item.isSelected()); Rectangle rect = numericChannelList.getCellBounds(index, index); numericChannelList.repaint(rect); checkSelectedChannels(); updateTimeBounds(); } }); JScrollPane scrollPane = new JScrollPane(numericChannelList); c.fill = GridBagConstraints.BOTH; c.weightx = 0; c.weighty = 1; c.gridx = 0; c.gridy = 4; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(scrollPane, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 5); container.add(new JLabel("Data file: "), c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; dataFileTextField = new JTextField(20); c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(dataFileTextField, c); dataFileTextField .setText(UIUtilities.getCurrentDirectory().getAbsolutePath() + File.separator + "data.dat"); dataFileButton = new JButton("Browse"); dataFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { File selectedFile = new File(dataFileTextField.getText()); selectedFile = UIUtilities.getFile("OK", "Select export file", selectedFile); if (selectedFile != null) { dataFileTextField.setText(selectedFile.getAbsolutePath()); } } }); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 2; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 0, 10, 10); container.add(dataFileButton, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 6; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 5); container.add(new JLabel("File format: "), c); fileFormatComboBox = new JComboBox(fileFormats.toArray()); fileFormatComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { fileFormatUpdated(); } }); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 6; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 0, 10, 10); container.add(fileFormatComboBox, c); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); Action exportAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -5356258138620428023L; public void actionPerformed(ActionEvent e) { ok(); } }; exportAction.putValue(Action.NAME, "Export"); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "export"); actionMap.put("export", exportAction); exportButton = new JButton(exportAction); panel.add(exportButton); Action cancelAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -5868609501314154642L; public void actionPerformed(ActionEvent e) { cancel(); } }; cancelAction.putValue(Action.NAME, "Cancel"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); actionMap.put("cancel", cancelAction); cancelButton = new JButton(cancelAction); panel.add(cancelButton); c.fill = GridBagConstraints.NONE; c.weightx = 0.5; c.gridx = 0; c.gridy = 7; c.gridwidth = GridBagConstraints.REMAINDER; ; c.anchor = GridBagConstraints.LINE_END; c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(panel, c); pack(); if (getWidth() < 600) { setSize(600, getHeight()); } dataFileTextField.requestFocusInWindow(); setLocationByPlatform(true); }
From source file:org.rdv.ui.ExportVideoDialog.java
private void initComponents() { JPanel container = new JPanel(); setContentPane(container);/* w w w.j a v a2 s. co m*/ InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = container.getActionMap(); container.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weighty = 0; c.gridwidth = 1; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; JLabel headerLabel = new JLabel("Select the time range and video channels to export."); headerLabel.setBackground(Color.white); headerLabel.setOpaque(true); headerLabel.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray), BorderFactory.createEmptyBorder(10, 10, 10, 10))); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 0, 0, 0); container.add(headerLabel, c); JPanel timeButtonPanel = new JPanel(); timeButtonPanel.setLayout(new BorderLayout()); MouseListener hoverMouseListener = new MouseAdapter() { public void mouseEntered(MouseEvent e) { e.getComponent().setForeground(Color.red); } public void mouseExited(MouseEvent e) { e.getComponent().setForeground(Color.blue); } }; startTimeButton = new JButton(); startTimeButton.setBorder(null); startTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); startTimeButton.setForeground(Color.blue); startTimeButton.addMouseListener(hoverMouseListener); startTimeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { double startTime = DateTimeDialog.showDialog(ExportVideoDialog.this, timeSlider.getStart(), timeSlider.getMinimum(), timeSlider.getEnd()); if (startTime >= 0) { timeSlider.setStart(startTime); } } }); timeButtonPanel.add(startTimeButton, BorderLayout.WEST); durationLabel = new JLabel(); durationLabel.setHorizontalAlignment(JLabel.CENTER); timeButtonPanel.add(durationLabel, BorderLayout.CENTER); endTimeButton = new JButton(); endTimeButton.setBorder(null); endTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); endTimeButton.setForeground(Color.blue); endTimeButton.addMouseListener(hoverMouseListener); endTimeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { double endTime = DateTimeDialog.showDialog(ExportVideoDialog.this, timeSlider.getEnd(), timeSlider.getStart(), timeSlider.getMaximum()); if (endTime >= 0) { timeSlider.setEnd(endTime); } } }); timeButtonPanel.add(endTimeButton, BorderLayout.EAST); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(10, 10, 10, 10); container.add(timeButtonPanel, c); timeSlider = new TimeSlider(); timeSlider.setValueChangeable(false); timeSlider.setValueVisible(false); timeSlider.addTimeAdjustmentListener(new TimeAdjustmentListener() { public void timeChanged(TimeEvent event) { } public void rangeChanged(TimeEvent event) { updateTimeRangeLabel(); } public void boundsChanged(TimeEvent event) { } }); updateTimeRangeLabel(); updateTimeBounds(); List<EventMarker> markers = rbnb.getMarkerManager().getMarkers(); for (EventMarker marker : markers) { timeSlider.addMarker(marker); } c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(timeSlider, c); JLabel numericHeaderLabel = new JLabel("Video Channels:"); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 3; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(numericHeaderLabel, c); videoChannelList = new JList(videoChannelModel); videoChannelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); videoChannelList.setCellRenderer(new CheckListRenderer()); videoChannelList.setVisibleRowCount(10); videoChannelList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int index = videoChannelList.locationToIndex(e.getPoint()); ExportChannel item = (ExportChannel) videoChannelList.getModel().getElementAt(index); item.setSelected(!item.isSelected()); Rectangle rect = videoChannelList.getCellBounds(index, index); videoChannelList.repaint(rect); updateTimeBounds(); } }); JScrollPane scrollPane = new JScrollPane(videoChannelList); c.fill = GridBagConstraints.BOTH; c.weightx = 0; c.weighty = 1; c.gridx = 0; c.gridy = 4; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(scrollPane, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 5); container.add(new JLabel("Choose Directory: "), c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; directoryTextField = new JTextField(20); c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(directoryTextField, c); directoryTextField.setText(UIUtilities.getCurrentDirectory().getAbsolutePath()); directoryButton = new JButton("Browse"); directoryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { File selectedDirectory = UIUtilities.getDirectory("Select export directory"); if (selectedDirectory != null) { directoryTextField.setText(selectedDirectory.getAbsolutePath()); } } }); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 2; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 0, 10, 10); container.add(directoryButton, c); exportProgressBar = new JProgressBar(0, 100000); exportProgressBar.setStringPainted(true); exportProgressBar.setValue(0); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.gridx = 0; c.gridy = 6; c.gridwidth = GridBagConstraints.REMAINDER; ; c.anchor = GridBagConstraints.CENTER; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(exportProgressBar, c); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); Action exportAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = 1547500154252213911L; public void actionPerformed(ActionEvent e) { exportVideo(); } }; exportAction.putValue(Action.NAME, "Export"); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "export"); actionMap.put("export", exportAction); exportButton = new JButton(exportAction); panel.add(exportButton); Action cancelAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -7440298547807878651L; public void actionPerformed(ActionEvent e) { cancel(); } }; cancelAction.putValue(Action.NAME, "Cancel"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); actionMap.put("cancel", cancelAction); cancelButton = new JButton(cancelAction); panel.add(cancelButton); c.fill = GridBagConstraints.NONE; c.weightx = 0.5; c.gridx = 0; c.gridy = 7; c.gridwidth = GridBagConstraints.REMAINDER; ; c.anchor = GridBagConstraints.LINE_END; c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(panel, c); pack(); if (getWidth() < 600) { setSize(600, getHeight()); } directoryTextField.requestFocusInWindow(); setLocationByPlatform(true); setVisible(true); }
From source file:com.projity.pm.graphic.graph.GraphInteractor.java
protected Cursor getProgressCursor() { if (progressCursor == null) { try {// w ww . j a v a2s.com progressCursor = Toolkit.getDefaultToolkit().createCustomCursor( IconManager.getImage("gantt.progress.cursor"), new Point(15, 5), "ProgressCursor"); } catch (Exception e) { progressCursor = new Cursor(Cursor.HAND_CURSOR); } } return progressCursor; }
From source file:com.projity.pm.graphic.graph.GraphInteractor.java
protected Cursor getLinkCursor() { if (linkCursor == null) { try {//from w w w .j a va 2 s . c o m linkCursor = Toolkit.getDefaultToolkit().createCustomCursor( IconManager.getImage("gantt.link.cursor"), new Point(7, 3), "linkCursor"); } catch (Exception e) { linkCursor = new Cursor(Cursor.HAND_CURSOR); } } return linkCursor; }
From source file:aurelienribon.gdxsetupui.ui.MainPanel.java
private void initUI() { startSetupBtn.addActionListener(new ActionListener() { @Override//from w w w . j a v a 2 s. c om public void actionPerformed(ActionEvent e) { showSetupView(); } }); startUpdateBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showUpdateView(); } }); changeModeBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showInitView(); } }); JLabel aboutLabel = new JLabel("About this app >"); Style.registerCssClasses(aboutLabel, ".linkLabel"); aboutLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); versionLabel.setLayout(new BorderLayout()); versionLabel.add(aboutLabel, BorderLayout.EAST); aboutLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { showAboutPanel(); } }); }