List of usage examples for javax.swing SwingConstants LEADING
int LEADING
To view the source code for javax.swing SwingConstants LEADING.
Click Source Link
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Nursing() { final CollapsiblePane cpOrga = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.nursing") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override//from www .j ava 2 s . c o m public void actionPerformed(ActionEvent e) { try { cpOrga.setCollapsed(!cpOrga.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpOrga.setTitleLabelComponent(cptitle.getMain()); cpOrga.setSlidingDirection(SwingConstants.SOUTH); cpOrga.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpOrga.setContentPane(createContentPanel4Nursing()); } }); if (!cpOrga.isCollapsed()) { cpOrga.setContentPane(createContentPanel4Nursing()); } cpOrga.setHorizontalAlignment(SwingConstants.LEADING); return cpOrga; }
From source file:op.FrmMain.java
/** * This method is called from within the constructor to * initialize the form./*from w w w .ja v a 2 s . co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { pnlMain = new JPanel(); pnlMainMessage = new JPanel(); btnTX = new JButton(); panel1 = new JPanel(); pnlIcons = new JPanel(); lblMainMsg = new JLabel(); btnExit = new JButton(); lblSubMsg = new JideLabel(); btnHelp = new JButton(); pbMsg = new JProgressBar(); btnReload = new JButton(); splitPaneLeft = new JideSplitPane(); pnlCard = new JPanel(); pnlWait = new JPanel(); lblWait = new JLabel(); pbTimeout = new JProgressBar(); panel2 = new JPanel(); btnResetSplitpane = new JButton(); statusBar = new StatusBar(); //======== this ======== setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle("Offene-Pflege.de"); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { thisWindowClosing(e); } }); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS)); //======== pnlMain ======== { pnlMain.setLayout(new FormLayout("0dlu, $lcgap, pref, $lcgap, left:default:grow, 2*($rgap)", "$rgap, pref, $rgap, default:grow, 3dlu, $nlgap, bottom:pref, $lgap, 0dlu")); //======== pnlMainMessage ======== { pnlMainMessage.setBackground(new Color(220, 223, 208)); pnlMainMessage.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED)); pnlMainMessage.setLayout(new FormLayout( "0dlu, $lcgap, 23dlu, $lcgap, default:grow, $lcgap, min, $lcgap, 0dlu", "0dlu, $lgap, 15dlu, $lgap, fill:11dlu, $lgap, fill:pref:grow, $lgap, pref, $lgap, 0dlu")); //---- btnTX ---- btnTX.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/ambulance2.png"))); btnTX.setBorder(null); btnTX.setBorderPainted(false); btnTX.setSelectedIcon(null); btnTX.setToolTipText("Verlegungsbericht drucken"); btnTX.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnTX.setPressedIcon( new ImageIcon(getClass().getResource("/artwork/32x32/ambulance2_pressed.png"))); btnTX.setContentAreaFilled(false); btnTX.addActionListener(e -> btnTXActionPerformed(e)); pnlMainMessage.add(btnTX, CC.xywh(3, 3, 1, 3)); //======== panel1 ======== { panel1.setOpaque(false); panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS)); //======== pnlIcons ======== { pnlIcons.setOpaque(false); pnlIcons.setLayout(new BoxLayout(pnlIcons, BoxLayout.LINE_AXIS)); } panel1.add(pnlIcons); //---- lblMainMsg ---- lblMainMsg.setText("OPDE"); lblMainMsg.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 22)); lblMainMsg.setForeground(new Color(105, 80, 69)); lblMainMsg.setHorizontalAlignment(SwingConstants.CENTER); lblMainMsg.setIcon(null); lblMainMsg.setHorizontalTextPosition(SwingConstants.LEADING); panel1.add(lblMainMsg); } pnlMainMessage.add(panel1, CC.xy(5, 3, CC.CENTER, CC.DEFAULT)); //---- btnExit ---- btnExit.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/lock.png"))); btnExit.setBorder(null); btnExit.setBorderPainted(false); btnExit.setOpaque(false); btnExit.setContentAreaFilled(false); btnExit.setToolTipText("Abmelden"); btnExit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnExit.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/lock_pressed.png"))); btnExit.addActionListener(e -> btnExitActionPerformed(e)); pnlMainMessage.add(btnExit, CC.xywh(7, 3, 1, 3)); //---- lblSubMsg ---- lblSubMsg.setText("OPDE"); lblSubMsg.setFont(new Font("Arial", Font.PLAIN, 14)); lblSubMsg.setForeground(new Color(105, 80, 69)); lblSubMsg.setHorizontalAlignment(SwingConstants.CENTER); lblSubMsg.setVerticalAlignment(SwingConstants.TOP); pnlMainMessage.add(lblSubMsg, CC.xywh(5, 5, 1, 3)); //---- btnHelp ---- btnHelp.setText(null); btnHelp.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/help.png"))); btnHelp.setBorderPainted(false); btnHelp.setContentAreaFilled(false); btnHelp.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/help_pressed.png"))); btnHelp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnHelp.addActionListener(e -> btnHelpActionPerformed(e)); pnlMainMessage.add(btnHelp, CC.xywh(3, 7, 1, 3)); //---- pbMsg ---- pbMsg.setValue(50); pbMsg.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 12)); pbMsg.setForeground(new Color(105, 80, 69)); pnlMainMessage.add(pbMsg, CC.xy(5, 9, CC.FILL, CC.FILL)); //---- btnReload ---- btnReload.setIcon(new ImageIcon(getClass().getResource("/artwork/32x32/reload0000.png"))); btnReload.setBorder(null); btnReload.setBorderPainted(false); btnReload.setOpaque(false); btnReload.setContentAreaFilled(false); btnReload.setToolTipText("Ansicht aktualisieren"); btnReload.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnReload .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/reload_pressed.png"))); btnReload.addActionListener(e -> btnReloadActionPerformed(e)); pnlMainMessage.add(btnReload, CC.xywh(7, 7, 1, 3)); } pnlMain.add(pnlMainMessage, CC.xywh(3, 2, 4, 1, CC.DEFAULT, CC.FILL)); //---- splitPaneLeft ---- splitPaneLeft.setOneTouchExpandable(true); splitPaneLeft.setProportionalLayout(true); splitPaneLeft.setShowGripper(true); splitPaneLeft.addPropertyChangeListener("dividerLocation", e -> splitPaneLeftPropertyChange(e)); pnlMain.add(splitPaneLeft, CC.xy(3, 4, CC.FILL, CC.FILL)); //======== pnlCard ======== { pnlCard.setLayout(new CardLayout()); //======== pnlWait ======== { pnlWait.setLayout(new BorderLayout()); //---- lblWait ---- lblWait.setText("text"); lblWait.setFont(new Font("Arial", Font.BOLD, 22)); lblWait.setHorizontalAlignment(SwingConstants.CENTER); pnlWait.add(lblWait, BorderLayout.CENTER); } pnlCard.add(pnlWait, "cardWait"); } pnlMain.add(pnlCard, CC.xy(5, 4, CC.FILL, CC.FILL)); pnlMain.add(pbTimeout, CC.xywh(3, 5, 4, 1, CC.FILL, CC.DEFAULT)); //======== panel2 ======== { panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- btnResetSplitpane ---- btnResetSplitpane.setText(null); btnResetSplitpane .setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/view_top_bottom.png"))); btnResetSplitpane.setAlignmentY(1.0F); btnResetSplitpane.addActionListener(e -> btnResetSplitpaneActionPerformed(e)); panel2.add(btnResetSplitpane); //---- statusBar ---- statusBar.setBackground(new Color(238, 238, 238)); statusBar.setAlignmentY(1.0F); panel2.add(statusBar); } pnlMain.add(panel2, CC.xywh(3, 7, 4, 1, CC.FILL, CC.BOTTOM)); } contentPane.add(pnlMain); setSize(945, 695); setLocationRelativeTo(getOwner()); }
From source file:op.users.PnlUser.java
private CollapsiblePane createCP4(final Users user) { final String key = user.getUID() + ".xusers"; if (!cpMap.containsKey(key)) { cpMap.put(key, new CollapsiblePane()); try {/* ww w. j a v a 2s . com*/ cpMap.get(key).setCollapsed(true); } catch (PropertyVetoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } final CollapsiblePane cp = cpMap.get(key); DefaultCPTitle cptitle = new DefaultCPTitle("<html><font size=+1>" + user.toString() + (UsersTools.isQualified(user) ? ", " + SYSTools.xx("opde.users.qualifiedNurse") : "") + "</font></html>", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { cp.setCollapsed(!cp.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); /*** * ____ _ ______ __ * / ___| |__ __ _ _ __ __ _ ___| _ \ \ / / * | | | '_ \ / _` | '_ \ / _` |/ _ \ |_) \ \ /\ / / * | |___| | | | (_| | | | | (_| | __/ __/ \ V V / * \____|_| |_|\__,_|_| |_|\__, |\___|_| \_/\_/ * |___/ */ final JButton btnChangePW = new JButton(SYSConst.icon22password); btnChangePW.setPressedIcon(SYSConst.icon22passwordPressed); btnChangePW.setAlignmentX(Component.RIGHT_ALIGNMENT); btnChangePW.setContentAreaFilled(false); btnChangePW.setBorder(null); btnChangePW.setToolTipText(SYSTools.xx("opde.users.btnChangePW.tooltip")); btnChangePW.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Users myUser = em.merge(usermap.get(user.getUID())); String newpw = SYSTools.generatePassword(myUser.getVorname(), myUser.getName()); em.lock(myUser, LockModeType.OPTIMISTIC); myUser.setMd5pw(SYSTools.hashword(newpw)); em.getTransaction().commit(); lstUsers.remove(user); lstUsers.add(myUser); usermap.put(key, myUser); Collections.sort(lstUsers); SYSTools.printpw(newpw, myUser); OPDE.getDisplayManager().addSubMessage(new DisplayMessage(SYSTools.xx("opde.users.pwchanged"))); } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); btnChangePW.setEnabled(user.isActive()); cptitle.getRight().add(btnChangePW); /*** * _ _ _ _ _ ___ _ _ * | |__ | |_ _ __ / \ ___| |_(_)_ _____|_ _|_ __ __ _ ___| |_(_)_ _____ * | '_ \| __| '_ \ / _ \ / __| __| \ \ / / _ \| || '_ \ / _` |/ __| __| \ \ / / _ \ * | |_) | |_| | | |/ ___ \ (__| |_| |\ V / __/| || | | | (_| | (__| |_| |\ V / __/ * |_.__/ \__|_| |_/_/ \_\___|\__|_| \_/ \___|___|_| |_|\__,_|\___|\__|_| \_/ \___| * */ final JButton btnActiveInactive = new JButton( user.isActive() ? SYSConst.icon22stop : SYSConst.icon22playerPlay); btnActiveInactive .setPressedIcon(user.isActive() ? SYSConst.icon22stopPressed : SYSConst.icon22playerPlayPressed); btnActiveInactive.setAlignmentX(Component.RIGHT_ALIGNMENT); btnActiveInactive.setContentAreaFilled(false); btnActiveInactive.setBorder(null); btnActiveInactive.setToolTipText(SYSTools .xx(internalClassID + (user.isActive() ? ".btnActiveInactive.stop" : ".btnActiveInactive.play"))); btnActiveInactive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Users myUser = em.merge(usermap.get(user.getUID())); em.lock(myUser, LockModeType.OPTIMISTIC); myUser.setStatus(myUser.isActive() ? UsersTools.STATUS_INACTIVE : UsersTools.STATUS_ACTIVE); em.getTransaction().commit(); lstUsers.remove(user); lstUsers.add(myUser); usermap.put(myUser.getUID(), myUser); Collections.sort(lstUsers); CollapsiblePane cp = createCP4(myUser); boolean wasCollapsed = cpMap.get(key).isCollapsed(); cpMap.put(key, cp); cp.setCollapsed(myUser.isActive() ? wasCollapsed : true); 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 (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); cptitle.getRight().add(btnActiveInactive); /*** * _ _ _ * ___ __| (_) |_ * / _ \/ _` | | __| * | __/ (_| | | |_ * \___|\__,_|_|\__| * */ final JButton btnEdit = new JButton(SYSConst.icon22edit3); btnEdit.setPressedIcon(SYSConst.icon22edit3Pressed); btnEdit.setAlignmentX(Component.RIGHT_ALIGNMENT); btnEdit.setContentAreaFilled(false); btnEdit.setBorder(null); btnEdit.setToolTipText(SYSTools.xx("opde.users.btnEdit")); btnEdit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgUser(user, new Closure() { @Override public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Users myUser = em.merge((Users) o); em.lock(myUser, LockModeType.OPTIMISTIC); em.getTransaction().commit(); lstUsers.remove(user); lstUsers.add(myUser); usermap.put(myUser.getUID(), myUser); Collections.sort(lstUsers); CollapsiblePane cp = createCP4(myUser); boolean wasCollapsed = cpMap.get(key).isCollapsed(); cpMap.put(key, cp); cp.setCollapsed(myUser.isActive() ? wasCollapsed : true); 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 (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } } }); } }); cptitle.getRight().add(btnEdit); cp.setTitleLabelComponent(cptitle.getMain()); cp.setSlidingDirection(SwingConstants.SOUTH); /*** * ___ ___ _ _ _____ ___ _ _ _____ * / __/ _ \| \| |_ _| __| \| |_ _| * | (_| (_) | .` | | | | _|| .` | | | * \___\___/|_|\_| |_| |___|_|\_| |_| * */ cp.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { if (!contentMap.containsKey(key)) { contentMap.put(key, new PnlEditMemberships(user, lstGroups)); } cp.setContentPane(contentMap.get(key)); cp.setOpaque(false); } } ); cp.setBackground(UsersTools.getBG1(user)); cp.setCollapsible(user.isActive()); cp.setHorizontalAlignment(SwingConstants.LEADING); cp.setOpaque(false); return cp; }
From source file:op.users.PnlUser.java
private CollapsiblePane createCP4(final Groups group) { final String key = group.getGID() + ".xgroups"; if (!cpMap.containsKey(key)) { cpMap.put(key, new CollapsiblePane()); cpMap.get(key).setSlidingDirection(SwingConstants.SOUTH); cpMap.get(key).setBackground(bg); cpMap.get(key).setForeground(fg); cpMap.get(key).addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override/*from w w w. j av a 2 s.c o m*/ public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { if (!contentMap.containsKey(key)) { contentMap.put(key, createContentPanel4(group)); } cpMap.get(key).setContentPane(contentMap.get(key)); } }); cpMap.get(key).setHorizontalAlignment(SwingConstants.LEADING); cpMap.get(key).setOpaque(false); try { cpMap.get(key).setCollapsed(true); } catch (PropertyVetoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } final CollapsiblePane cp = cpMap.get(key); DefaultCPTitle cpTitle = new DefaultCPTitle("<html><font size=+1>" + group.getGID().toUpperCase() + (group.isQualified() ? ", " + SYSTools.xx("opde.users.qualifiedGroup") : "") + "</font></html>", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { cp.setCollapsed(!cp.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); /*** * _ _ _ * __| | ___| | ___| |_ ___ __ _ _ __ ___ _ _ _ __ * / _` |/ _ \ |/ _ \ __/ _ \ / _` | '__/ _ \| | | | '_ \ * | (_| | __/ | __/ || __/ | (_| | | | (_) | |_| | |_) | * \__,_|\___|_|\___|\__\___| \__, |_| \___/ \__,_| .__/ * |___/ |_| */ final JButton btnDeleteGroup = new JButton(SYSConst.icon22delete); btnDeleteGroup.setPressedIcon(SYSConst.icon22deletePressed); btnDeleteGroup.setAlignmentX(Component.RIGHT_ALIGNMENT); btnDeleteGroup.setContentAreaFilled(false); btnDeleteGroup.setBorder(null); btnDeleteGroup.setToolTipText(SYSTools.xx("opde.users.btnDeleteGroup")); btnDeleteGroup.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgYesNo(SYSTools.xx("misc.questions.delete1") + "<br/><i>" + group.getGID() + "</i><br/>" + SYSTools.xx("misc.questions.delete2"), SYSConst.icon48delete, new Closure() { @Override public void execute(Object o) { if (o.equals(JOptionPane.YES_OPTION)) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Groups myGroup = em.merge(group); em.remove(myGroup); em.getTransaction().commit(); lstGroups.remove(group); cpMap.remove(key); 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 (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } } }); } }); btnDeleteGroup.setEnabled(!group.isSystem()); cpTitle.getRight().add(btnDeleteGroup); cp.setTitleLabelComponent(cpTitle.getMain()); if (!cp.isCollapsed()) { if (!contentMap.containsKey(key)) { contentMap.put(key, createContentPanel4(group)); } cp.setContentPane(contentMap.get(key)); } return cp; }
From source file:org.geopublishing.atlasViewer.GpCoreUtil.java
public static JDialog getWaitDialog(final Component owner, final String msg) { final JDialog waitFrame = new JDialog(SwingUtil.getParentWindow(owner)); waitFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); final JPanel cp = new JPanel(new MigLayout()); final JLabel label = new JLabel(msg, Icons.ICON_TASKRUNNING_BIG, SwingConstants.LEADING); cp.add(label);// w ww . ja v a 2 s . c o m waitFrame.setContentPane(cp); waitFrame.setAlwaysOnTop(true); waitFrame.pack(); SwingUtil.centerFrameOnScreen(waitFrame); waitFrame.setVisible(true); return waitFrame; }
From source file:org.kse.gui.dialogs.DCheckUpdate.java
private void initComponents() { jlCheckUpdate = new JLabel(res.getString("DCheckUpdate.jlCheckUpdate.text")); ImageIcon icon = new ImageIcon(getClass().getResource(res.getString("DCheckUpdate.jlCheckUpdate.image"))); jlCheckUpdate.setIcon(icon);/*from w ww .j ava2 s. co m*/ jlCheckUpdate.setHorizontalTextPosition(SwingConstants.LEADING); jlCheckUpdate.setIconTextGap(15); jpCheckUpdate = new JPanel(new FlowLayout(FlowLayout.CENTER)); jpCheckUpdate.add(jlCheckUpdate); jpCheckUpdate.setBorder(new EmptyBorder(5, 5, 5, 5)); jpbCheckUpdate = new JProgressBar(); jpbCheckUpdate.setIndeterminate(true); jpbCheckUpdate.setString("DCheckUpdate.jlCheckUpdate.text"); jpProgress = new JPanel(new FlowLayout(FlowLayout.CENTER)); jpProgress.add(jpbCheckUpdate); jpProgress.setBorder(new EmptyBorder(5, 5, 5, 5)); jbCancel = new JButton(res.getString("DCheckUpdate.jbCancel.text")); jbCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY); jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); jpCancel = PlatformUtil.createDialogButtonPanel(jbCancel, false); getContentPane().add(jpCheckUpdate, BorderLayout.NORTH); getContentPane().add(jpProgress, BorderLayout.CENTER); getContentPane().add(jpCancel, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { if ((checker != null) && (checker.isAlive())) { checker.interrupt(); } closeDialog(); } }); setTitle(res.getString("DCheckUpdate.Title")); setResizable(false); pack(); }
From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java
private JPanel createButtonPanel() { JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, SystemColor.windowBorder)); buttonPanel.setOpaque(true);/*from w w w .ja v a2 s . c o m*/ buttonPanel.setBackground(ColorAndFontConstants.MID_BACKGROUND_COLOR); buttonPanel.setComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); Action helpAction; if (ComponentOrientation.LEFT_TO_RIGHT == ComponentOrientation .getOrientation(controller.getLocaliser().getLocale())) { helpAction = new HelpContextAction(controller, ImageLoader.HELP_CONTENTS_BIG_ICON_FILE, "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText", HelpContentsPanel.HELP_PREFERENCES_URL); } else { helpAction = new HelpContextAction(controller, ImageLoader.HELP_CONTENTS_BIG_RTL_ICON_FILE, "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText", HelpContentsPanel.HELP_PREFERENCES_URL); } HelpButton helpButton = new HelpButton(helpAction, controller); helpButton.setText(""); helpButton.setToolTipText(controller.getLocaliser().getString("multiBitFrame.helpMenuTooltip")); helpButton.setHorizontalAlignment(SwingConstants.LEADING); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 0.3; constraints.weighty = 0.1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; buttonPanel.add(helpButton, constraints); ShowPreferencesSubmitAction submitAction = new ShowPreferencesSubmitAction(this.bitcoinController, this.exchangeController, this, ImageLoader.createImageIcon(ImageLoader.PREFERENCES_ICON_FILE), mainFrame); MultiBitButton submitButton = new MultiBitButton(submitAction, controller); buttonPanel.add(submitButton); UndoPreferencesChangesSubmitAction undoChangesAction = new UndoPreferencesChangesSubmitAction(controller, ImageLoader.createImageIcon(ImageLoader.UNDO_ICON_FILE)); undoChangesButton = new MultiBitButton(undoChangesAction, controller); buttonPanel.add(undoChangesButton); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 0; constraints.weightx = 0.1; constraints.weighty = 1.0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; buttonPanel.add(submitButton, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 2; constraints.gridy = 0; constraints.weightx = 0.1; constraints.weighty = 1.0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; buttonPanel.add(undoChangesButton, constraints); JPanel fill1 = new JPanel(); fill1.setOpaque(false); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 2; constraints.gridy = 0; constraints.weightx = 200; constraints.weighty = 1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_END; buttonPanel.add(fill1, constraints); return buttonPanel; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Formats the specified label./*from w w w. j ava2 s .c om*/ * * @param label The label to format. */ private void formatLabel(JLabel label) { label.setHorizontalTextPosition(SwingConstants.LEADING); label.setAlignmentX(SwingConstants.RIGHT); label.setVisible(false); }
From source file:org.tinymediamanager.ui.tvshows.TvShowTreeCellRenderer.java
/** * Instantiates a new tv show tree cell renderer. *///from ww w . j a va2 s . c o m public TvShowTreeCellRenderer() { tvShowPanel.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("min:grow"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px") }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); TmmFontHelper.changeFont(tvShowTitle, Font.BOLD); tvShowTitle.setHorizontalAlignment(JLabel.LEFT); tvShowTitle.setMinimumSize(new Dimension(0, 0)); tvShowTitle.setHorizontalTextPosition(SwingConstants.LEADING); tvShowPanel.add(tvShowTitle, "1, 1"); tvShowPanel.add(tvShowNfoLabel, "3, 1, 1, 2"); tvShowPanel.add(tvShowImageLabel, "4, 1, 1, 2"); TmmFontHelper.changeFont(tvShowInfo, 0.816); tvShowInfo.setHorizontalAlignment(JLabel.LEFT); tvShowInfo.setMinimumSize(new Dimension(0, 0)); tvShowPanel.add(tvShowInfo, "1, 2"); tvShowSeasonPanel.setLayout(new BoxLayout(tvShowSeasonPanel, BoxLayout.Y_AXIS)); tvShowSeasonPanel.add(tvShowSeasonTitle); tvShowSeasonTitle.setHorizontalTextPosition(SwingConstants.LEADING); tvShowEpisodePanel .setLayout( new FormLayout( new ColumnSpec[] { ColumnSpec.decode("min:grow"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px") }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC })); tvShowEpisodeTitle.setMinimumSize(new Dimension(0, 0)); tvShowEpisodeTitle.setHorizontalTextPosition(SwingConstants.LEADING); tvShowEpisodePanel.add(tvShowEpisodeTitle, "1, 1"); tvShowEpisodePanel.add(tvShowEpisodeNfoLabel, "3, 1"); tvShowEpisodePanel.add(tvShowEpisodeImageLabel, "4, 1"); tvShowEpisodePanel.add(tvShowEpisodeSubtitleLabel, "5, 1"); }
From source file:org.zaproxy.zap.extension.autoupdate.AddOnDependencyChecker.java
private boolean confirmChanges(Component parent, AddOnChangesResult changesResult, boolean updating) { Set<AddOn> selectedAddOnsJavaIssue = new HashSet<>(); for (AddOn addOn : changesResult.getSelectedAddOns()) { if (!addOn.canRunInCurrentJavaVersion()) { selectedAddOnsJavaIssue.add(addOn); }/*w ww .j a va 2s . co m*/ } String question; Set<AddOn> installs = new HashSet<>(changesResult.getInstalls()); Set<AddOn> updates = new HashSet<>(changesResult.getNewVersions()); Set<AddOn> dependents = getDependents(updates, changesResult.getUninstalls()); if (updating) { question = Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUpdate"); updates.removeAll(changesResult.getSelectedAddOns()); } else { question = Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithInstallation"); installs.removeAll(changesResult.getSelectedAddOns()); } if (changesResult.getUninstalls().isEmpty() && updates.isEmpty() && installs.isEmpty() && dependents.isEmpty() && changesResult.getOptionalAddOns().isEmpty() && changesResult.getSoftUnloadExtensions().isEmpty() && changesResult.getUnloadExtensions().isEmpty()) { // No other changes required. if (selectedAddOnsJavaIssue.isEmpty()) { // No need to ask for confirmation. return true; } int size = changesResult.getSelectedAddOns().size(); if (size == 1) { String baseMessage = MessageFormat.format( Constant.messages .getString("cfu.confirmation.dialogue.message.selectedAddOnNewerJavaVersion"), changesResult.getSelectedAddOns().iterator().next().getMinimumJavaVersion()); return JOptionPane.showConfirmDialog(parent, baseMessage + question, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; } String mainMessage; if (selectedAddOnsJavaIssue.size() == size) { mainMessage = Constant.messages .getString("cfu.confirmation.dialogue.message.addOnsNewerJavaVersion"); } else { mainMessage = Constant.messages .getString("cfu.confirmation.dialogue.message.someSelectedAddOnsNewerJavaVersion"); } JLabel label = new JLabel( Constant.messages.getString("cfu.confirmation.dialogue.message.warnAddOnsNotRunJavaVersion"), ManageAddOnsDialog.ICON_ADD_ON_ISSUES, SwingConstants.LEADING); Object[] msgs = { mainMessage, createScrollableTable( new AddOnTableModel(selectedAddOnsJavaIssue, selectedAddOnsJavaIssue.size())), label, question }; return JOptionPane.showConfirmDialog(parent, msgs, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; } JPanel panel = new JPanel(new BorderLayout()); JTabbedPane tabs = new JTabbedPane(); panel.add(tabs); int issues = selectedAddOnsJavaIssue.size(); if (!selectedAddOnsJavaIssue.isEmpty()) { tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.selectedAddOns"), createScrollableTable( new AddOnTableModel(selectedAddOnsJavaIssue, selectedAddOnsJavaIssue.size()))); } if (!changesResult.getUninstalls().isEmpty()) { tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.uninstallations"), createScrollableTable(new AddOnTableModel(changesResult.getUninstalls(), false))); } if (!updates.isEmpty()) { AddOnTableModel model = new AddOnTableModel(updates); issues += model.getMinimumJavaVersionIssues(); tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.updats"), createScrollableTable(model)); } if (!installs.isEmpty()) { AddOnTableModel model = new AddOnTableModel(installs); issues += model.getMinimumJavaVersionIssues(); tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.installations"), createScrollableTable(model)); } if (!dependents.isEmpty()) { AddOnTableModel model = new AddOnTableModel(dependents); issues += model.getMinimumJavaVersionIssues(); tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.softUninstalls"), createScrollableTable(model)); } SelectableAddOnTableModel optionalAddOnsTableModel = null; if (!changesResult.getOptionalAddOns().isEmpty()) { optionalAddOnsTableModel = new SelectableAddOnTableModel(changesResult.getOptionalAddOns()); issues += optionalAddOnsTableModel.getMinimumJavaVersionIssues(); tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.optionalAddOns"), createScrollableTable(optionalAddOnsTableModel)); } if (!changesResult.getUnloadExtensions().isEmpty()) { ExtensionsTableModel model = new ExtensionsTableModel(changesResult.getUnloadExtensions()); tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionUnloads"), createScrollableTable(model)); } if (!changesResult.getSoftUnloadExtensions().isEmpty()) { ExtensionsTableModel model = new ExtensionsTableModel(changesResult.getSoftUnloadExtensions()); tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionSoftUnloads"), createScrollableTable(model)); } List<Object> optionPaneContents = new ArrayList<>(); if (!changesResult.getOptionalAddOns().isEmpty() && changesResult.getUninstalls().isEmpty() && updates.isEmpty() && installs.isEmpty() && dependents.isEmpty() && changesResult.getSoftUnloadExtensions().isEmpty() && changesResult.getUnloadExtensions().isEmpty()) { optionPaneContents .add(Constant.messages.getString("cfu.confirmation.dialogue.message.suggestedChanges")); } else if (!changesResult.getOptionalAddOns().isEmpty()) { optionPaneContents .add(Constant.messages.getString("cfu.confirmation.dialogue.message.requiredSuggestedChanges")); } else { optionPaneContents .add(Constant.messages.getString("cfu.confirmation.dialogue.message.requiredChanges")); } optionPaneContents.add(panel); if (issues != 0) { String message; if (selectedAddOnsJavaIssue.size() == issues) { if (selectedAddOnsJavaIssue.size() == changesResult.getSelectedAddOns().size()) { message = Constant.messages .getString("cfu.confirmation.dialogue.message.selectedAddOnsNewerJavaVersion"); } else { message = Constant.messages.getString( "cfu.confirmation.dialogue.message.someUnnamedSelectedAddOnsNewerJavaVersion"); } } else if (issues == 1) { message = Constant.messages.getString("cfu.confirmation.dialogue.message.addOnNewerJavaVersion"); } else { message = Constant.messages .getString("cfu.confirmation.dialogue.message.someAddOnsNewerJavaVersion"); } JLabel label = new JLabel( Constant.messages.getString( "cfu.confirmation.dialogue.message.warnUnknownNumberAddOnsNotRunJavaVersion"), ManageAddOnsDialog.ICON_ADD_ON_ISSUES, SwingConstants.LEADING); optionPaneContents.add(message); optionPaneContents.add(label); } optionPaneContents.add(question); boolean confirmed = JOptionPane.showConfirmDialog(parent, optionPaneContents.toArray(), Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (confirmed && optionalAddOnsTableModel != null) { changesResult.getInstalls().addAll(optionalAddOnsTableModel.getSelectedAddOns()); } return confirmed; }