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:org.revager.gui.findings_list.FindingsListFrame.java
private void createAttPanel() { GridLayout grid = new GridLayout(4, 1); grid.setVgap(8);//from ww w. jav a 2s . co m JPanel attendeeButtons = new JPanel(grid); addResiAtt = GUITools.newImageButton(); addResiAtt.setIcon(Data.getInstance().getIcon("addResiAtt_25x25_0.png")); addResiAtt.setRolloverIcon(Data.getInstance().getIcon("addResiAtt_25x25.png")); addResiAtt.setToolTipText(translate("Add Attendee from the Attendee Pool")); addResiAtt.addActionListener(ActionRegistry.getInstance().get(AddResiAttToProtAction.class.getName())); attendeeButtons.add(addResiAtt); JButton addAttendee = GUITools.newImageButton(); addAttendee.setIcon(Data.getInstance().getIcon("addAttendee_25x25_0.png")); addAttendee.setRolloverIcon(Data.getInstance().getIcon("addAttendee_25x25.png")); addAttendee.setToolTipText(translate("Add Attendee")); addAttendee.addActionListener(ActionRegistry.getInstance().get(AddAttToProtAction.class.getName())); attendeeButtons.add(addAttendee); removeAttendee = GUITools.newImageButton(); removeAttendee.setIcon(Data.getInstance().getIcon("removeAttendee_25x25_0.png")); removeAttendee.setRolloverIcon(Data.getInstance().getIcon("removeAttendee_25x25.png")); removeAttendee.setToolTipText(translate("Remove Attendee")); removeAttendee.addActionListener(ActionRegistry.getInstance().get(RemAttFromProtAction.class.getName())); attendeeButtons.add(removeAttendee); editAttendee = GUITools.newImageButton(); editAttendee.setIcon(Data.getInstance().getIcon("editAttendee_25x25_0.png")); editAttendee.setRolloverIcon(Data.getInstance().getIcon("editAttendee_25x25.png")); editAttendee.setToolTipText(translate("Edit Attendee")); editAttendee.addActionListener(ActionRegistry.getInstance().get(EditAttFromProtAction.class.getName())); attendeeButtons.add(editAttendee); editAttendee.setEnabled(false); removeAttendee.setEnabled(false); presentAttTable.setRowHeight(55); presentAttTable.getColumnModel().getColumn(0).setMaxWidth(55); presentAttTable.setShowHorizontalLines(false); presentAttTable.setShowVerticalLines(true); presentAttTable.setShowGrid(true); presentAttTable.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { ActionRegistry.getInstance().get(EditAttFromProtAction.class.getName()).actionPerformed(null); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); TableCellRenderer renderer = (table, value, isSelected, hasFocus, row, column) -> { JLabel label = new JLabel((String) value); label.setOpaque(true); label.setBorder(new EmptyBorder(5, 5, 5, 5)); label.setFont(UI.VERY_LARGE_FONT); if (isSelected) { label.setBackground(presentAttTable.getSelectionBackground()); } else { if (row % 2 == 0) { label.setBackground(UI.TABLE_ALT_COLOR); } else { label.setBackground(presentAttTable.getBackground()); } } return label; }; for (int i = 1; i <= 4; i++) { presentAttTable.getColumnModel().getColumn(i).setCellRenderer(renderer); } TableColumn col = presentAttTable.getColumnModel().getColumn(0); col.setCellRenderer((table, value, isSelected, hasFocus, row, column) -> { JPanel localPnl = new JPanel(); localPnl.add(new JLabel(Data.getInstance().getIcon("attendee_40x40.png"))); if (isSelected) { localPnl.setBackground(presentAttTable.getSelectionBackground()); } else { if (row % 2 == 0) { localPnl.setBackground(UI.TABLE_ALT_COLOR); } else { localPnl.setBackground(presentAttTable.getBackground()); } } return localPnl; }); presentAttTable.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { updateAttButtons(); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); scrllP = GUITools.setIntoScrollPane(presentAttTable); scrllP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); scrllP.setToolTipText(translate("Add Attendee to Meeting")); scrllP.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (isAddResiAttPossible()) { ActionRegistry.getInstance().get(AddResiAttToProtAction.class.getName()).actionPerformed(null); } else { ActionRegistry.getInstance().get(AddAttToProtAction.class.getName()).actionPerformed(null); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); JLabel labelAttendees = new JLabel(translate("Attendees of the current meeting:")); labelAttendees.setFont(UI.HUGE_FONT_BOLD); GUITools.addComponent(attPanel, gbl, labelAttendees, 0, 0, 2, 1, 1.0, 0.0, 20, 20, 0, 20, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); GUITools.addComponent(attPanel, gbl, scrllP, 0, 1, 1, 1, 1.0, 1.0, 20, 20, 0, 20, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST); GUITools.addComponent(attPanel, gbl, attendeeButtons, 1, 1, 1, 1, 0, 0, 20, 0, 20, 20, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST); }
From source file:ca.phon.app.project.ProjectWindow.java
private MultiActionButton createNewCorpusButton() { MultiActionButton retVal = new MultiActionButton(); ImageIcon folderNewIcn = IconManager.getInstance().getIcon("places/folder", IconSize.SMALL); ImageIcon newIcnL = IconManager.getInstance().getIcon("actions/list-add", IconSize.MEDIUM); ImageIcon removeIcnL = IconManager.getInstance().getIcon("actions/list-remove", IconSize.MEDIUM); ImageIcon renameIcnL = IconManager.getInstance().getIcon("actions/edit-rename", IconSize.MEDIUM); String s1 = "Corpus"; retVal.getTopLabel().setText(WorkspaceTextStyler.toHeaderText(s1)); retVal.getTopLabel().setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); retVal.getTopLabel().setFont(FontPreferences.getTitleFont()); retVal.getTopLabel().setIcon(folderNewIcn); retVal.setOpaque(false);//from w w w . java2 s . c om PhonUIAction newAct = new PhonUIAction(this, "onSwapNewAndCreateCorpus", retVal); newAct.putValue(Action.LARGE_ICON_KEY, newIcnL); newAct.putValue(Action.SMALL_ICON, folderNewIcn); newAct.putValue(Action.NAME, "New corpus"); newAct.putValue(Action.SHORT_DESCRIPTION, "Create a new corpus folder"); DeleteCorpusAction deleteCurrentAct = new DeleteCorpusAction(this); deleteCurrentAct.putValue(Action.LARGE_ICON_KEY, removeIcnL); PhonUIAction renameCurrentAct = new PhonUIAction(this, "onRenameCorpus"); renameCurrentAct.putValue(Action.LARGE_ICON_KEY, renameIcnL); renameCurrentAct.putValue(Action.NAME, "Rename corpus"); renameCurrentAct.putValue(Action.SHORT_DESCRIPTION, "Rename selected corpus"); retVal.setDisplayDefaultAction(true); retVal.addAction(deleteCurrentAct); retVal.addAction(renameCurrentAct); retVal.setDefaultAction(newAct); retVal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return retVal; }
From source file:base.BasePlayer.BedCanvas.java
void drawSidebar() { buf.setColor(Draw.sidecolor.darker()); buf.fillRect(0, 0, Main.sidebarWidth - 4, this.getHeight()); // buf.setColor(Draw.softColor); // buf.fillRect(0, 0, Main.sidebarWidth, this.getHeight()); buf.setColor(Color.black);//from ww w . j a va2 s . c om if (bedTrack.size() > 0) { // buf.setStroke(Draw.doubleStroke); overlapping = false; for (int i = 0; i < bedTrack.size(); i++) { if (!buf.getColor().equals(Color.black)) { buf.setColor(Color.black); } if (i == 0) { trackstart = Main.defaultFontSize; trackheight = (int) (trackDivider.get(i) * this.getHeight()); } else { trackstart = Main.defaultFontSize + (int) (trackDivider.get(i - 1) * this.getHeight()); trackheight = (int) (trackDivider.get(i) * this.getHeight()) - (int) (trackDivider.get(i - 1) * this.getHeight()); } if (bedTrack.get(i).file != null) { buf.drawString(bedTrack.get(i).file.getName(), 10, trackstart); } else { buf.drawString(FilenameUtils.getName(bedTrack.get(i).url.getFile()), 10, trackstart); } if (trackheight > Main.defaultFontSize + Main.defaultFontSize + (int) (Main.defaultFontSize * 1.4)) { if ((int) bedTrack.get(i).playbox.y != trackstart + Main.defaultFontSize) { bedTrack.get(i).playbox.setBounds(10, trackstart + Main.defaultFontSize, (int) (Main.defaultFontSize * 1.4), (int) (Main.defaultFontSize * 1.4)); bedTrack.get(i).playTriangle.reset(); bedTrack.get(i).playTriangle.addPoint( bedTrack.get(i).playbox.x + (Main.defaultFontSize / 5), bedTrack.get(i).playbox.y + (Main.defaultFontSize / 5)); bedTrack.get(i).playTriangle.addPoint( bedTrack.get(i).playbox.x + (Main.defaultFontSize / 5), bedTrack.get(i).playbox.y + (bedTrack.get(i).playbox.width - (Main.defaultFontSize / 5))); bedTrack.get(i).playTriangle.addPoint( bedTrack.get(i).playbox.x + (bedTrack.get(i).playbox.width - (Main.defaultFontSize / 5)), bedTrack.get(i).playbox.y + bedTrack.get(i).playbox.height / 2); bedTrack.get(i).graphBox.setBounds( bedTrack.get(i).playbox.x + (int) (Main.defaultFontSize * 1.4) + Main.defaultFontSize, trackstart + Main.defaultFontSize, (int) (Main.defaultFontSize * 1.4), (int) (Main.defaultFontSize * 1.4)); if (bedTrack.get(i).settingsButton == null) { bedTrack.get(i).settingsButton = new Rectangle(); } bedTrack.get(i).settingsButton.setBounds( Main.sidebarWidth - (int) (this.remoBox.width * (1.8)) - 4, trackstart - Main.defaultFontSize, (int) (this.remoBox.width * (1.5)) + 2, (int) (this.remoBox.height * (1.5))); } if (bedTrack.get(i).settingsButton == null) { bedTrack.get(i).settingsButton = new Rectangle(); } if (bedTrack.get(i).settingsButton.y == 0 || bedTrack.get(i).settingsButton.x != Main.sidebarWidth - (int) (this.remoBox.width * (1.8)) || bedTrack.get(i).settingsButton.width != (int) (this.remoBox.width * (1.5)) + 2) { bedTrack.get(i).settingsButton.setBounds( Main.sidebarWidth - (int) (this.remoBox.width * (1.8)), trackstart - Main.defaultFontSize - 4, (int) (this.remoBox.width * (1.5)) + 2, (int) (this.remoBox.height * (1.5))); } if (Main.varsamples > 0 || FileRead.caller) { if (bedTrack.get(i).getCurrent() != null || (!bedTrack.get(i).small || bedTrack.get(i).getZoomlevel() != null)) { buf.setColor(Color.white); buf.fillRoundRect(bedTrack.get(i).playbox.getBounds().x - 1, bedTrack.get(i).playbox.getBounds().y - 1, bedTrack.get(i).playbox.getBounds().width, bedTrack.get(i).playbox.getBounds().height, 2, 2); buf.setColor(Color.gray); buf.fillRoundRect(bedTrack.get(i).playbox.getBounds().x + 1, bedTrack.get(i).playbox.getBounds().y + 1, bedTrack.get(i).playbox.getBounds().width, bedTrack.get(i).playbox.getBounds().height, 2, 2); if (sideMouseRect.intersects(bedTrack.get(i).playbox)) { overlapping = true; if (getCursor().getType() != Cursor.HAND_CURSOR) { selectedPlay = i; setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } buf.setColor(Color.white); // buf.drawRect(bedTrack.get(i).playbox.getBounds().x-1,bedTrack.get(i).playbox.getBounds().y-1,bedTrack.get(i).playbox.getBounds().width+1, bedTrack.get(i).playbox.getBounds().height+1); buf.fillRoundRect(bedTrack.get(i).playbox.getBounds().x, bedTrack.get(i).playbox.getBounds().y, bedTrack.get(i).playbox.getBounds().width, bedTrack.get(i).playbox.getBounds().height, 2, 2); } else { buf.setColor(Draw.sidecolor); buf.fillRoundRect(bedTrack.get(i).playbox.getBounds().x, bedTrack.get(i).playbox.getBounds().y, bedTrack.get(i).playbox.getBounds().width, bedTrack.get(i).playbox.getBounds().height, 2, 2); } if (bedTrack.get(i).intersect) { buf.setColor(Draw.greenColor); buf.fillRect(bedTrack.get(i).playTriangle.getBounds().x, bedTrack.get(i).playTriangle.getBounds().y, bedTrack.get(i).playTriangle.getBounds().width, bedTrack.get(i).playTriangle.getBounds().height); } else { buf.setColor(Draw.redColor); buf.fillPolygon(bedTrack.get(i).playTriangle); } } } if (bedTrack.get(i).hasvalues) { if (bedTrack.get(i).getCurrent() != null || !bedTrack.get(i).small) { buf.setColor(Color.lightGray); buf.fillRect(bedTrack.get(i).graphBox.getBounds().x, bedTrack.get(i).graphBox.getBounds().y, bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().height); buf.setColor(Color.white); buf.fillRoundRect(bedTrack.get(i).graphBox.getBounds().x - 1, bedTrack.get(i).graphBox.getBounds().y - 1, bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().height, 2, 2); buf.setColor(Color.gray); buf.fillRoundRect(bedTrack.get(i).graphBox.getBounds().x + 1, bedTrack.get(i).graphBox.getBounds().y + 1, bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().height, 2, 2); if (sideMouseRect.intersects(bedTrack.get(i).graphBox)) { overlapping = true; if (getCursor().getType() != Cursor.HAND_CURSOR) { selectedPlay = i; setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } buf.setColor(Color.white); // buf.drawRect(bedTrack.get(i).graphBox.getBounds().x-1,bedTrack.get(i).graphBox.getBounds().y-1,bedTrack.get(i).graphBox.getBounds().width+1, bedTrack.get(i).graphBox.getBounds().height+1); buf.fillRoundRect(bedTrack.get(i).graphBox.getBounds().x, bedTrack.get(i).graphBox.getBounds().y, bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().height, 2, 2); } else { buf.setColor(Draw.sidecolor); buf.fillRoundRect(bedTrack.get(i).graphBox.getBounds().x, bedTrack.get(i).graphBox.getBounds().y, bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().height, 2, 2); } if (bedTrack.get(i).graph) { buf.setColor(Draw.greenColor); buf.drawLine(bedTrack.get(i).graphBox.getBounds().x, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height, bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 4, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 2); buf.drawLine( bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 4, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 2, bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 2, bedTrack.get(i).graphBox.getBounds().y + (int) (bedTrack.get(i).graphBox.getBounds().height * 0.66)); buf.drawLine( bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 2, bedTrack.get(i).graphBox.getBounds().y + (int) (bedTrack.get(i).graphBox.getBounds().height * 0.66), (int) (bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width * 0.66), bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 4); buf.drawLine( (int) (bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width * 0.66), bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 4, bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 2); } else { buf.setColor(Draw.redColor); buf.drawLine(bedTrack.get(i).graphBox.getBounds().x, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height, bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 4, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 2); buf.drawLine( bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 4, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 2, bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 2, bedTrack.get(i).graphBox.getBounds().y + (int) (bedTrack.get(i).graphBox.getBounds().height * 0.66)); buf.drawLine( bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width / 2, bedTrack.get(i).graphBox.getBounds().y + (int) (bedTrack.get(i).graphBox.getBounds().height * 0.66), (int) (bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width * 0.66), bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 4); buf.drawLine( (int) (bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width * 0.66), bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 4, bedTrack.get(i).graphBox.getBounds().x + bedTrack.get(i).graphBox.getBounds().width, bedTrack.get(i).graphBox.getBounds().y + bedTrack.get(i).graphBox.getBounds().height / 2); } /*if(sideMouseRect.intersects(bedTrack.get(i).graphBox)) { overlapping = true; selectedPlay = i; if(getCursor().getType() != Cursor.HAND_CURSOR) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } buf.setColor(Color.white); buf.drawRect(bedTrack.get(i).graphBox.getBounds().x-1,bedTrack.get(i).graphBox.getBounds().y-1,bedTrack.get(i).graphBox.getBounds().width+1, bedTrack.get(i).graphBox.getBounds().height+1); }*/ } } } if (trackheight > bedTrack.get(i).settingsButton.height) { /*if(this.sideMouseRect.intersects(bedTrack.get(i).settingsButton)) { buf.setColor(Color.white); } else { }*/ buf.setColor(Draw.sidecolor.darker()); buf.fillRect(bedTrack.get(i).settingsButton.x, bedTrack.get(i).settingsButton.y, bedTrack.get(i).settingsButton.width, bedTrack.get(i).settingsButton.height); buf.drawImage(Main.settingsIcon.getImage(), Main.sidebarWidth - (int) (this.remoBox.width * (1.8)) - 4, trackstart - Main.defaultFontSize, (int) (this.remoBox.width * (1.5)), (int) (this.remoBox.height * (1.5)), this); } } if (!overlapping && !resizer) { if (getCursor().getType() != Cursor.DEFAULT_CURSOR) { selectedPlay = -1; setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (sidebar) { buf.setColor(Color.black); if (sidebar && sideMouseRect.intersects(this.remoBox)) { // buf.setStroke(Draw.doubleStroke); removeTrack = hoverIndex; buf.setColor(Color.white); buf.fillRect(this.remoBox.x - 2, this.remoBox.y - 1, this.remoBox.width + 2, this.remoBox.height + 2); } else { removeTrack = -1; if (this.remoBox.getBounds().x != Main.sidebarWidth - (Main.defaultFontSize + 10) - 4 || this.remoBox.getBounds().y != (int) (trackDivider.get(hoverIndex) * this.getHeight()) - (Main.defaultFontSize + 6)) { this.remoBox.setBounds(Main.sidebarWidth - (Main.defaultFontSize + 10) - 4, (int) (trackDivider.get(hoverIndex) * this.getHeight()) - (Main.defaultFontSize + 6), Main.defaultFontSize + 3, Main.defaultFontSize + 3); } /* if(this.remoBox.getBounds().y != (int)(trackDivider.get(hoverIndex)*this.getHeight())-11|| this.remoBox.getBounds().x != Main.sidebarWidth-11) { this.remoBox.setBounds(Main.sidebarWidth-11, (int)(trackDivider.get(hoverIndex)*this.getHeight())-11, 8, 8); }*/ } buf.setColor(Color.black); buf.drawRect(this.remoBox.x, this.remoBox.y, this.remoBox.width, this.remoBox.height); buf.drawLine(this.remoBox.x, this.remoBox.y, this.remoBox.x + this.remoBox.width, this.remoBox.y + (int) this.remoBox.getHeight()); buf.drawLine(this.remoBox.x, this.remoBox.y + (int) this.remoBox.getHeight(), this.remoBox.x + this.remoBox.width, this.remoBox.y); } buf.setStroke(Draw.doubleStroke); buf.setColor(Color.gray); buf.drawLine(Main.sidebarWidth - 5, 0, Main.sidebarWidth - 5, this.getHeight()); buf.drawLine(1, 0, 1, this.getHeight()); buf.setColor(Color.lightGray); buf.drawLine(3, 0, 3, this.getHeight()); buf.drawLine(Main.sidebarWidth - 7, 0, Main.sidebarWidth - 7, this.getHeight()); buf.setStroke(Draw.basicStroke); } }
From source file:op.care.values.PnlValues.java
private JPanel createContentPanel4Year(final ResValueTypes vtype, final int year) { final String keyYears = vtype.getID() + ".xtypes." + Integer.toString(year) + ".year"; java.util.List<ResValue> myValues; synchronized (mapType2Values) { if (!mapType2Values.containsKey(keyYears)) { mapType2Values.put(keyYears, ResValueTools.getResValues(resident, vtype, year)); }//w ww .j a v a 2 s. c om if (mapType2Values.get(keyYears).isEmpty()) { JLabel lbl = new JLabel(SYSTools.xx("misc.msg.novalue")); JPanel pnl = new JPanel(); pnl.add(lbl); return pnl; } myValues = mapType2Values.get(keyYears); } JPanel pnlYear = new JPanel(new VerticalLayout()); pnlYear.setOpaque(false); for (final ResValue resValue : myValues) { String title = "<html><table border=\"0\">" + "<tr>" + "<td width=\"200\" align=\"left\">" + DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT).format(resValue.getPit()) + " [" + resValue.getID() + "]</td>" + "<td width=\"340\" align=\"left\">" + ResValueTools.getValueAsHTML(resValue) + "</td>" + "<td width=\"200\" align=\"left\">" + resValue.getUser().getFullname() + "</td>" + "</tr>" + "</table>" + "</html>"; final DefaultCPTitle pnlTitle = new DefaultCPTitle(title, null); pnlTitle.getMain().setBackground(GUITools.blend(vtype.getColor(), Color.WHITE, 0.1f)); pnlTitle.getMain().setOpaque(true); if (resValue.isObsolete()) { pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22eraser)); } if (resValue.isReplacement()) { pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22edited)); } if (!resValue.getText().trim().isEmpty()) { pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22info)); } if (pnlTitle.getAdditionalIconPanel().getComponentCount() > 0) { pnlTitle.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GUITools.showPopup( GUITools.getHTMLPopup(pnlTitle.getButton(), ResValueTools.getInfoAsHTML(resValue)), SwingConstants.NORTH); } }); } if (!resValue.getAttachedFilesConnections().isEmpty()) { /*** * _ _ _____ _ _ * | |__ | |_ _ __ | ___(_) | ___ ___ * | '_ \| __| '_ \| |_ | | |/ _ \/ __| * | |_) | |_| | | | _| | | | __/\__ \ * |_.__/ \__|_| |_|_| |_|_|\___||___/ * */ final JButton btnFiles = new JButton( Integer.toString(resValue.getAttachedFilesConnections().size()), SYSConst.icon22greenStar); btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip")); btnFiles.setForeground(Color.BLUE); btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER); btnFiles.setFont(SYSConst.ARIAL18BOLD); btnFiles.setPressedIcon(SYSConst.icon22Pressed); btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT); btnFiles.setAlignmentY(Component.TOP_ALIGNMENT); btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnFiles.setContentAreaFilled(false); btnFiles.setBorder(null); btnFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgFiles(resValue, new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final ResValue myValue = em.find(ResValue.class, resValue.getID()); em.close(); synchronized (mapType2Values) { mapType2Values.get(keyYears).remove(resValue); mapType2Values.get(keyYears).add(myValue); Collections.sort(mapType2Values.get(keyYears)); } createCP4Year(vtype, year); buildPanel(); } }); } }); btnFiles.setEnabled(OPDE.isFTPworking()); pnlTitle.getRight().add(btnFiles); } if (!resValue.getAttachedProcessConnections().isEmpty()) { /*** * _ _ ____ * | |__ | |_ _ __ | _ \ _ __ ___ ___ ___ ___ ___ * | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __| * | |_) | |_| | | | __/| | | (_) | (_| __/\__ \__ \ * |_.__/ \__|_| |_|_| |_| \___/ \___\___||___/___/ * */ final JButton btnProcess = new JButton( Integer.toString(resValue.getAttachedProcessConnections().size()), SYSConst.icon22redStar); btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip")); btnProcess.setForeground(Color.YELLOW); btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER); btnProcess.setFont(SYSConst.ARIAL18BOLD); btnProcess.setPressedIcon(SYSConst.icon22Pressed); btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT); btnProcess.setAlignmentY(Component.TOP_ALIGNMENT); btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnProcess.setContentAreaFilled(false); btnProcess.setBorder(null); btnProcess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgProcessAssign(resValue, new Closure() { @Override public void execute(Object o) { if (o == null) { return; } Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o; ArrayList<QProcess> assigned = result.getFirst(); ArrayList<QProcess> unassigned = result.getSecond(); EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); ResValue myValue = em.merge(resValue); em.lock(myValue, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSVAL2PROCESS> attached = new ArrayList<SYSVAL2PROCESS>( resValue.getAttachedProcessConnections()); for (SYSVAL2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections() .remove(linkObject); linkObject.getResValue().getAttachedProcessConnections() .remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + myValue.getTitle() + " ID: " + myValue.getID(), PReportTools.PREPORT_TYPE_REMOVE_ELEMENT, linkObject.getQProcess())); em.remove(linkObject); } } attached.clear(); for (QProcess qProcess : assigned) { java.util.List<QProcessElement> listElements = qProcess.getElements(); if (!listElements.contains(myValue)) { QProcess myQProcess = em.merge(qProcess); SYSVAL2PROCESS myLinkObject = em .merge(new SYSVAL2PROCESS(myQProcess, myValue)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + myValue.getTitle() + " ID: " + myValue.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedResValueConnections().add(myLinkObject); myValue.getAttachedProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); synchronized (mapType2Values) { mapType2Values.get(keyYears).remove(resValue); mapType2Values.get(keyYears).add(myValue); Collections.sort(mapType2Values.get(keyYears)); } createCP4Year(vtype, year); buildPanel(); } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (RollbackException ole) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); } }); btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)); pnlTitle.getRight().add(btnProcess); } /*** * __ __ * | \/ | ___ _ __ _ _ * | |\/| |/ _ \ '_ \| | | | * | | | | __/ | | | |_| | * |_| |_|\___|_| |_|\__,_| * */ final JButton btnMenu = new JButton(SYSConst.icon22menu); btnMenu.setPressedIcon(SYSConst.icon22Pressed); btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT); btnMenu.setAlignmentY(Component.TOP_ALIGNMENT); btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMenu.setContentAreaFilled(false); btnMenu.setBorder(null); btnMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JidePopup popup = new JidePopup(); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnMenu); popup.removeExcludedComponent(btnMenu); JPanel pnl = getMenu(resValue); popup.getContentPane().add(pnl); popup.setDefaultFocusComponent(pnl); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnMenu.setEnabled(!resValue.isObsolete()); pnlTitle.getRight().add(btnMenu); pnlYear.add(pnlTitle.getMain()); synchronized (linemap) { linemap.put(resValue, pnlTitle.getMain()); } } return pnlYear; }
From source file:org.revager.gui.findings_list.FindingsListFrame.java
private void createBottomOrgPanel() { JLabel locationLbl = new JLabel(translate("Location:")); locationLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel dateLbl = new JLabel(translate("Date:")); dateLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel beginLbl = new JLabel(translate("Period of time:")); beginLbl.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel tillLabel = new JLabel(translate("to")); tillLabel.setFont(UI.VERY_LARGE_FONT_BOLD); clockLabel.setFont(UI.VERY_LARGE_FONT_BOLD); dateTxtFld = new ObservingTextField(); dateTxtFld.setFont(UI.VERY_LARGE_FONT); dateTxtFld.setFocusable(false);// w ww . j ava 2s . co m dateTxtFld.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); dateTxtFld.setPreferredSize(new Dimension(190, (int) dateTxtFld.getPreferredSize().getHeight())); dateTxtFld.setMinimumSize(dateTxtFld.getPreferredSize()); dateTxtFld.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { // instantiate the DatePicker DatePicker dp = new DatePicker(UI.getInstance().getProtocolFrame(), UI.getInstance().getProtocolFrame().getDateTxtFld()); // previously selected date Date selectedDate = dp.parseDate(UI.getInstance().getProtocolFrame().getDateTxtFld().getText()); dp.setSelectedDate(selectedDate); dp.start(UI.getInstance().getProtocolFrame().getDateTxtFld()); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); dateTxtFld.addKeyListener(updateListener); /* * creating spinner panel */ beginMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1)); beginHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1)); endMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1)); endHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1)); beginMSpinner.setFont(UI.VERY_LARGE_FONT); beginHSpinner.setFont(UI.VERY_LARGE_FONT); endHSpinner.setFont(UI.VERY_LARGE_FONT); endMSpinner.setFont(UI.VERY_LARGE_FONT); beginMSpinner.addChangeListener(spinnerChangeListener); beginHSpinner.addChangeListener(spinnerChangeListener); endHSpinner.addChangeListener(spinnerChangeListener); endMSpinner.addChangeListener(spinnerChangeListener); locationTxtFld = new JTextField(); locationTxtFld.setFont(UI.VERY_LARGE_FONT); /* * Hide border if the application runs on Mac OS X */ boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC; GUITools.formatSpinner(endHSpinner, hideBorder); GUITools.formatSpinner(endMSpinner, hideBorder); GUITools.formatSpinner(beginHSpinner, hideBorder); GUITools.formatSpinner(beginMSpinner, hideBorder); // TODO: In some cases 'currentProt.getDate()' returns null. dateF.setTimeZone(currentProt.getDate().getTimeZone()); dateTxtFld.setText(dateF.format(currentProt.getDate().getTime())); int beginHours = currentProt.getStart().get(Calendar.HOUR_OF_DAY); beginMSpinner.setValue(currentProt.getStart().get(Calendar.MINUTE)); beginHSpinner.setValue(beginHours); int endHours = currentProt.getEnd().get(Calendar.HOUR_OF_DAY); endMSpinner.setValue(currentProt.getEnd().get(Calendar.MINUTE)); endHSpinner.setValue(endHours); /* * Correct the leading zero's */ if ((Integer) beginMSpinner.getValue() == 0) { ((NumberEditor) beginMSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) beginHSpinner.getValue() == 0) { ((NumberEditor) beginHSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) endMSpinner.getValue() == 0) { ((NumberEditor) endMSpinner.getEditor()).getTextField().setText("00"); } if ((Integer) endHSpinner.getValue() == 0) { ((NumberEditor) endHSpinner.getEditor()).getTextField().setText("00"); } locationTxtFld.setText(currentProt.getLocation().trim()); JPanel spinnerPanel = new JPanel(gbl); spinnerPanel.setOpaque(false); JLabel labelDoubleDot1 = new JLabel(":"); labelDoubleDot1.setFont(UI.VERY_LARGE_FONT_BOLD); JLabel labelDoubleDot2 = new JLabel(":"); labelDoubleDot2.setFont(UI.VERY_LARGE_FONT_BOLD); GUITools.addComponent(spinnerPanel, gbl, beginHSpinner, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot1, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, beginMSpinner, 2, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST); GUITools.addComponent(spinnerPanel, gbl, tillLabel, 3, 0, 1, 1, 1.0, 0, 0, 10, 0, 10, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, endHSpinner, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST); GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot2, 5, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER); GUITools.addComponent(spinnerPanel, gbl, endMSpinner, 6, 0, 1, 1, 0, 0, 0, 5, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST); /* * adding created components to orgpanel */ GUITools.addComponent(bottomOrgPanel, gbl, dateLbl, 2, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, dateTxtFld, 3, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, locationLbl, 0, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, locationTxtFld, 1, 0, 1, 1, 1.0, 1.0, 10, 5, 0, 10, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); GUITools.addComponent(bottomOrgPanel, gbl, beginLbl, 5, 0, 1, 1, 0.0, 1.0, 10, 30, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); GUITools.addComponent(bottomOrgPanel, gbl, spinnerPanel, 6, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 25, GridBagConstraints.VERTICAL, GridBagConstraints.WEST); updateAttButtons(); }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private boolean setupPreviewPanel(List<PreviewPart> previewParts) { boolean blnTransferWithWarnings = false; jpnPreviewHeader.removeAll();/*w w w .j av a 2 s .co m*/ jpnPreviewFooter.removeAll(); // setup parameter scroll pane jpnPreviewContent.removeAll(); double[] rowContraints = new double[previewParts.size()]; for (int i = 0; i < previewParts.size(); i++) rowContraints[i] = TableLayout.PREFERRED; final int iWidthBeginnigSpace = 3; final int iWidthSeparator = 6; final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); JLabel lbPreviewHeaderEntity = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.11", "Entit\u00e4t")); JLabel lbPreviewHeaderTable = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.12", "Tabellenname")); JLabel lbPreviewHeaderRecords = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.4", "Datens\u00e4tze")); lbPreviewHeaderRecords.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.5", "Anzahl der betroffenen Datens\u00e4tze")); utils.initJPanel(jpnPreviewContent, new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED }, rowContraints); int iWidthEntityLabelSize = 0; int iWidthTableLabelSize = 0; int iWidthRecordsLabelSize = 0; int iCountNew = 0; int iCountDeleted = 0; int iCountChanged = 0; int iRow = 0; for (final PreviewPart pp : previewParts) { String tooltip = ""; JLabel lbEntity = new JLabel(pp.getEntity()); JLabel lbTable = new JLabel(pp.getTable()); JLabel lbRecords = new JLabel(String.valueOf(pp.getDataRecords())); lbRecords.setHorizontalAlignment(SwingConstants.RIGHT); if (lbEntity.getPreferredSize().width < lbPreviewHeaderEntity.getPreferredSize().width) lbEntity.setPreferredSize(lbPreviewHeaderEntity.getPreferredSize()); if (lbTable.getPreferredSize().width < lbPreviewHeaderTable.getPreferredSize().width) lbTable.setPreferredSize(lbPreviewHeaderTable.getPreferredSize()); if (lbRecords.getPreferredSize().width < lbPreviewHeaderRecords.getPreferredSize().width) lbRecords.setPreferredSize(lbPreviewHeaderRecords.getPreferredSize()); iWidthEntityLabelSize = iWidthEntityLabelSize < lbEntity.getPreferredSize().width ? lbEntity.getPreferredSize().width : iWidthEntityLabelSize; iWidthTableLabelSize = iWidthTableLabelSize < lbTable.getPreferredSize().width ? lbTable.getPreferredSize().width : iWidthTableLabelSize; iWidthRecordsLabelSize = iWidthRecordsLabelSize < lbRecords.getPreferredSize().width ? lbRecords.getPreferredSize().width : iWidthRecordsLabelSize; Icon icoStatement = null; switch (pp.getType()) { case PreviewPart.NEW: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.6", "Entit\u00e4t wird hinzugef\u00fcgt"); icoStatement = ParameterEditor.COMPARE_ICON_NEW; iCountNew++; break; case PreviewPart.CHANGE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.7", "Entit\u00e4t wird ge\u00e4ndert"); icoStatement = ParameterEditor.COMPARE_ICON_VALUE_CHANGED; iCountChanged++; break; case PreviewPart.DELETE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.8", "Entit\u00e4t wird gel\u00f6scht"); icoStatement = ParameterEditor.COMPARE_ICON_DELETED; iCountDeleted++; break; } JLabel lbIcon = new JLabel(icoStatement); JLabel lbStatemnts = new JLabel("<html><u>" + localeDelegate.getMessage("dbtransfer.import.step1.9", "Script anzeigen") + "...</u></html>"); lbStatemnts.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lbStatemnts.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { String statements = ""; for (String statement : pp.getStatements()) { statements = statements + statement + ";\n\n"; } JTextArea txtArea = new JTextArea(statements); txtArea.setEditable(false); txtArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JScrollPane scroll = new JScrollPane(txtArea); scroll.getVerticalScrollBar().setUnitIncrement(20); scroll.setPreferredSize(new Dimension(600, 300)); scroll.setBorder(BorderFactory.createEmptyBorder()); MainFrameTab overlayFrame = new MainFrameTab( localeDelegate.getMessage("dbtransfer.import.step1.10", "Script f\u00fcr") + " " + pp.getEntity() + " (" + pp.getTable() + ")"); overlayFrame.setLayeredComponent(scroll); ifrm.add(overlayFrame); } }); lbIcon.setToolTipText(tooltip); lbStatemnts.setToolTipText(tooltip); lbEntity.setToolTipText(tooltip); lbTable.setToolTipText(tooltip); jpnPreviewContent.add(lbEntity, "1," + iRow + ",l,c"); jpnPreviewContent.add(lbTable, "3," + iRow + ",l,c"); jpnPreviewContent.add(lbRecords, "5," + iRow + ",r,c"); jpnPreviewContent.add(lbIcon, "7," + iRow + ",l,c"); jpnPreviewContent.add(lbStatemnts, "8," + iRow + ",l,c"); if (pp.getWarning() > 0) { lbIcon.setIcon(Icons.getInstance().getIconPriorityCancel16()); blnTransferWithWarnings = true; } iRow++; } jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "4,0,4," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "6,0,6," + (iRow - 1)); // setup preview header utils.initJPanel(jpnPreviewHeader, new double[] { iWidthBeginnigSpace, iWidthEntityLabelSize, iWidthSeparator, iWidthTableLabelSize, iWidthSeparator, iWidthRecordsLabelSize, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); if (previewParts.isEmpty()) { jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.18", "Keine Struktur\u00e4nderungen am Datenbankschema.")), "0,0,8,0"); return blnTransferWithWarnings; } jpnPreviewHeader.add(lbPreviewHeaderEntity, "1,0"); jpnPreviewHeader.add(lbPreviewHeaderTable, "3,0"); jpnPreviewHeader.add(lbPreviewHeaderRecords, "5,0"); jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.13", "\u00c4nderung")), "7,0"); // setup preview footer utils.initJPanel(jpnPreviewFooter, new double[] { TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); final JLabel lbCompare = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.14", "\u00c4nderungen") + ":"); final JLabel lbCompareNew = new JLabel(iCountNew + ""); final JLabel lbCompareDeleted = new JLabel(iCountDeleted + ""); final JLabel lbCompareValueChanged = new JLabel(iCountChanged + ""); lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW); lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED); lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED); lbCompareNew.setToolTipText(localeDelegate.getMessage("dbtransfer.import.step1.15", "Neue Entit\u00e4ten")); lbCompareDeleted.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.17", "Gel\u00f6schte Entit\u00e4ten")); lbCompareValueChanged.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.16", "Ge\u00e4nderte Entit\u00e4ten")); jpnPreviewFooter.add(lbCompare, "1,0,r,c"); jpnPreviewFooter.add(lbCompareNew, "2,0,r,c"); jpnPreviewFooter.add(lbCompareValueChanged, "3,0,r,c"); jpnPreviewFooter.add(lbCompareDeleted, "4,0,r,c"); return blnTransferWithWarnings; }
From source file:rita.widget.SourceCode.java
public void loadCursor(MouseEvent e) { e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }
From source file:com.floreantpos.jasperreport.swing.JRViewerPanel.java
protected void createHyperlinks(List elements, int offsetX, int offsetY) { if (elements != null && elements.size() > 0) { for (Iterator it = elements.iterator(); it.hasNext();) { JRPrintElement element = (JRPrintElement) it.next(); JRImageMapRenderer imageMap = null; if (element instanceof JRPrintImage) { JRRenderable renderer = ((JRPrintImage) element).getRenderer(); if (renderer instanceof JRImageMapRenderer) { imageMap = (JRImageMapRenderer) renderer; if (!imageMap.hasImageAreaHyperlinks()) { imageMap = null; }//www . j a v a 2s . c om } } boolean hasImageMap = imageMap != null; JRPrintHyperlink hyperlink = null; if (element instanceof JRPrintHyperlink) { hyperlink = (JRPrintHyperlink) element; } boolean hasHyperlink = !hasImageMap && hyperlink != null && hyperlink.getHyperlinkTypeValue() != HyperlinkTypeEnum.NONE; boolean hasTooltip = hyperlink != null && hyperlink.getHyperlinkTooltip() != null; if (hasHyperlink || hasImageMap || hasTooltip) { JPanel link; if (hasImageMap) { Rectangle renderingArea = new Rectangle(0, 0, element.getWidth(), element.getHeight()); link = new ImageMapPanel(renderingArea, imageMap); } else //hasImageMap { link = new JPanel(); if (hasHyperlink) { link.addMouseListener(mouseListener); } } if (hasHyperlink) { link.setCursor(new Cursor(Cursor.HAND_CURSOR)); } link.setLocation((int) ((element.getX() + offsetX) * realZoom), (int) ((element.getY() + offsetY) * realZoom)); link.setSize((int) (element.getWidth() * realZoom), (int) (element.getHeight() * realZoom)); link.setOpaque(false); String toolTip = getHyperlinkTooltip(hyperlink); if (toolTip == null && hasImageMap) { toolTip = "";//not null to register the panel as having a tool tip } link.setToolTipText(toolTip); pnlLinks.add(link); linksMap.put(link, element); } if (element instanceof JRPrintFrame) { JRPrintFrame frame = (JRPrintFrame) element; int frameOffsetX = offsetX + frame.getX() + frame.getLineBox().getLeftPadding().intValue(); int frameOffsetY = offsetY + frame.getY() + frame.getLineBox().getTopPadding().intValue(); createHyperlinks(frame.getElements(), frameOffsetX, frameOffsetY); } } } }
From source file:com.mirth.connect.client.ui.Frame.java
/** * Builds the content panel with a title bar and settings. *//*from w ww. ja v a2s. com*/ private void buildContentPanel(JXTitledPanel container, JScrollPane component, boolean opaque) { container.getContentContainer().setLayout(new BorderLayout()); container.setBorder(null); container.setTitleFont(new Font("Tahoma", Font.BOLD, 18)); container.setTitleForeground(UIConstants.HEADER_TITLE_TEXT_COLOR); JLabel mirthConnectImage = new JLabel(); mirthConnectImage.setIcon(UIConstants.MIRTHCONNECT_LOGO_GRAY); mirthConnectImage.setText(" "); mirthConnectImage.setToolTipText(UIConstants.MIRTHCONNECT_TOOLTIP); mirthConnectImage.setCursor(new Cursor(Cursor.HAND_CURSOR)); mirthConnectImage.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { BareBonesBrowserLaunch.openURL(UIConstants.MIRTHCONNECT_URL); } }); ((JPanel) container.getComponent(0)).add(mirthConnectImage); component.setBorder(new LineBorder(Color.GRAY, 1)); component.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); component.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); container.getContentContainer().add(component); }
From source file:ca.phon.app.project.ProjectWindow.java
private MultiActionButton createNewSessionButton() { MultiActionButton retVal = new MultiActionButton(); ImageIcon newIcn = IconManager.getInstance().getIcon("mimetypes/text-xml", IconSize.SMALL); ImageIcon newIcnL = IconManager.getInstance().getIcon("actions/list-add", IconSize.MEDIUM); ImageIcon removeIcnL = IconManager.getInstance().getIcon("actions/list-remove", IconSize.MEDIUM); ImageIcon renameIcnL = IconManager.getInstance().getIcon("actions/edit-rename", IconSize.MEDIUM); ImageIcon openIcnL = IconManager.getInstance().getIcon("actions/view", IconSize.MEDIUM); String s1 = "Session"; retVal.getTopLabel().setText(WorkspaceTextStyler.toHeaderText(s1)); retVal.getTopLabel().setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); retVal.getTopLabel().setFont(FontPreferences.getTitleFont()); retVal.getTopLabel().setIcon(newIcn); retVal.setOpaque(false);//from w w w. j a v a2 s . c o m PhonUIAction newAct = new PhonUIAction(this, "onSwapNewAndCreateSession", retVal); newAct.putValue(Action.LARGE_ICON_KEY, newIcnL); newAct.putValue(Action.SMALL_ICON, newIcn); newAct.putValue(Action.NAME, "New session"); newAct.putValue(Action.SHORT_DESCRIPTION, "Create a new session in selected corpus"); retVal.setDefaultAction(newAct); DeleteSessionAction deleteCurrentAct = new DeleteSessionAction(this); deleteCurrentAct.putValue(Action.LARGE_ICON_KEY, removeIcnL); PhonUIAction renameCurrentAct = new PhonUIAction(this, "onRenameSession"); renameCurrentAct.putValue(Action.LARGE_ICON_KEY, renameIcnL); renameCurrentAct.putValue(Action.NAME, "Rename session"); renameCurrentAct.putValue(Action.SHORT_DESCRIPTION, "Rename selected session"); PhonUIAction openCurrentAct = new PhonUIAction(this, "onOpenSession"); openCurrentAct.putValue(Action.LARGE_ICON_KEY, openIcnL); openCurrentAct.putValue(Action.NAME, "Open session"); openCurrentAct.putValue(Action.SHORT_DESCRIPTION, "Open selected session"); retVal.setDisplayDefaultAction(true); retVal.addAction(deleteCurrentAct); retVal.addAction(renameCurrentAct); retVal.addAction(openCurrentAct); retVal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return retVal; }