List of usage examples for javax.swing SwingConstants CENTER
int CENTER
To view the source code for javax.swing SwingConstants CENTER.
Click Source Link
From source file:edu.ku.brc.specify.config.init.MasterUserPanel.java
@Override protected void init(final String title, final String[] fields, final boolean[] required, final String[] types, final Integer[] numColumns) { super.init(title, fields, required, types, numColumns); label = UIHelper.createLabel(" ", SwingConstants.CENTER); createMUBtn = UIHelper.createI18NButton("CREATE_MASTER_BTN"); PanelBuilder tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(createMUBtn, cc.xy(2, 1)); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,2px,p,2px,p")); panelPB.add(tstPB.getPanel(), cc.xy(1, 2)); panelPB.add(getProgressBar(), cc.xy(1, 4)); panelPB.add(label, cc.xy(1, 6));/* w w w . jav a2 s . com*/ builder.add(panelPB.getPanel(), cc.xyw(3, row, 2)); row += 2; // Advance part of pane advLabel = UIHelper.createI18NLabel("ADV_MU_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_MU_TEST"); JComponent sep = builder.addSeparator(UIRegistry.getResourceString("ADV_TITLE"), cc.xyw(3, row, 2)); row += 2; builder.add(advLabel, cc.xyw(3, row, 2)); row += 2; tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(skipStepBtn, cc.xy(2, 1)); builder.add(tstPB.getPanel(), cc.xyw(3, row, 2)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createMUBtn.setEnabled(false); skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); createMUBtn.setEnabled(true); skipStepBtn.setEnabled(true); advLabel.setText(UIRegistry.getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); } }); createMUBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createMasterUser(); } }); progressBar.setVisible(false); if (UIRegistry.isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); sep.setVisible(false); } }
From source file:org.gdms.usm.view.ProgressFrame.java
public ProgressFrame(Step s, boolean modifyThresholds) { super("Progress"); simulation = s;/* w w w . j av a 2 s . c o m*/ s.registerStepListener(this); stepSeconds = new LinkedList<Integer>(); s.getManager().setModifyThresholds(modifyThresholds); s.getManager().setAdvisor(this); JPanel statusPanel = new JPanel(new BorderLayout()); JPanel globalPanel = new JPanel(new SpringLayout()); //Time elapsed panel JPanel timePanel = new JPanel(new BorderLayout(5, 5)); final JLabel timeLabel = new JLabel("00:00:00", SwingConstants.CENTER); timeLabel.setFont(new Font("Serif", Font.BOLD, 45)); timePanel.add(timeLabel, BorderLayout.SOUTH); JLabel elapsed = new JLabel("Time Elapsed :", SwingConstants.CENTER); timePanel.add(elapsed, BorderLayout.NORTH); statusPanel.add(timePanel, BorderLayout.NORTH); ActionListener timerListener = new ActionListener() { public void actionPerformed(ActionEvent e) { totalSeconds++; int hours = totalSeconds / 3600; String hourss; if (hours < 10) { hourss = "0" + hours; } else { hourss = "" + hours; } int minutes = (totalSeconds % 3600) / 60; String minutess; if (minutes < 10) { minutess = "0" + minutes; } else { minutess = "" + minutes; } int seconds = totalSeconds % 60; String secondss; if (seconds < 10) { secondss = "0" + seconds; } else { secondss = seconds + ""; } timeLabel.setText(hourss + ":" + minutess + ":" + secondss); } }; timer = new Timer(1000, timerListener); timer.start(); //Turn progress panel JPanel turnPanel = new JPanel(new BorderLayout(5, 5)); JLabel turnLabel = new JLabel("Current Step :", SwingConstants.CENTER); turnPanel.add(turnLabel, BorderLayout.NORTH); currentTurn = new JLabel("Init", SwingConstants.CENTER); currentTurn.setFont(new Font("Serif", Font.BOLD, 30)); turnPanel.add(currentTurn, BorderLayout.SOUTH); globalPanel.add(turnPanel); //Movers panel JPanel moversPanel = new JPanel(new BorderLayout(5, 5)); JLabel moversLabel = new JLabel("Last movers count :", SwingConstants.CENTER); moversPanel.add(moversLabel, BorderLayout.NORTH); lastMoversCount = new JLabel("Init", SwingConstants.CENTER); lastMoversCount.setFont(new Font("Serif", Font.BOLD, 30)); moversPanel.add(lastMoversCount, BorderLayout.SOUTH); globalPanel.add(moversPanel); //Initial population panel JPanel initPopPanel = new JPanel(new BorderLayout(5, 5)); JLabel initialPopulationLabel = new JLabel("Initial population :", SwingConstants.CENTER); initPopPanel.add(initialPopulationLabel, BorderLayout.NORTH); initialPopulationCount = new JLabel("Init", SwingConstants.CENTER); initialPopulationCount.setFont(new Font("Serif", Font.BOLD, 30)); initPopPanel.add(initialPopulationCount, BorderLayout.SOUTH); globalPanel.add(initPopPanel); //Current population panel JPanel curPopPanel = new JPanel(new BorderLayout(5, 5)); JLabel currentPopulationLabel = new JLabel("Current population :", SwingConstants.CENTER); curPopPanel.add(currentPopulationLabel, BorderLayout.NORTH); currentPopulation = new JLabel("Init", SwingConstants.CENTER); currentPopulation.setFont(new Font("Serif", Font.BOLD, 30)); curPopPanel.add(currentPopulation, BorderLayout.SOUTH); globalPanel.add(curPopPanel); //Dead panel JPanel deadPanel = new JPanel(new BorderLayout(5, 5)); JLabel deadLabel = new JLabel("Last death toll :", SwingConstants.CENTER); deadPanel.add(deadLabel, BorderLayout.NORTH); lastDeathToll = new JLabel("Init", SwingConstants.CENTER); lastDeathToll.setFont(new Font("Serif", Font.BOLD, 30)); deadPanel.add(lastDeathToll, BorderLayout.SOUTH); globalPanel.add(deadPanel); //Newborn panel JPanel newbornPanel = new JPanel(new BorderLayout(5, 5)); JLabel newbornLabel = new JLabel("Last newborn count :", SwingConstants.CENTER); newbornPanel.add(newbornLabel, BorderLayout.NORTH); lastNewbornCount = new JLabel("Init", SwingConstants.CENTER); lastNewbornCount.setFont(new Font("Serif", Font.BOLD, 30)); newbornPanel.add(lastNewbornCount, BorderLayout.SOUTH); globalPanel.add(newbornPanel); SpringUtilities.makeCompactGrid(globalPanel, 3, 2, 5, 5, 20, 10); statusPanel.add(globalPanel, BorderLayout.SOUTH); add(statusPanel, BorderLayout.WEST); //Graph tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); timeChart = new XYSeries("Step time", true, false); tabbedPane.addTab("Step time", createChartPanel("Step time", timeChart)); currentPopulationChart = new XYSeries("Population", true, false); tabbedPane.addTab("Population", createChartPanel("Population", currentPopulationChart)); deathTollChart = new XYSeries("Deaths", true, false); tabbedPane.addTab("Deaths", createChartPanel("Deaths", deathTollChart)); newbornCountChart = new XYSeries("Newborn", true, false); tabbedPane.addTab("Newborn", createChartPanel("Newborn", newbornCountChart)); moversCountChart = new XYSeries("Movers", true, false); tabbedPane.addTab("Movers", createChartPanel("Movers", moversCountChart)); add(tabbedPane, BorderLayout.EAST); getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 10)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); }
From source file:com.floreantpos.ui.views.LoginPasswordEntryView.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.// w w w. j a v a 2 s.co m */ // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonPanel = new javax.swing.JPanel(); bottomPanel = new javax.swing.JPanel(); btnShutdown = new com.floreantpos.swing.PosButton(); setPreferredSize(new Dimension(320, 593)); setLayout(new BorderLayout()); buttonPanel.setOpaque(false); buttonPanel.setPreferredSize(new java.awt.Dimension(200, 180)); buttonPanel.setLayout(new MigLayout("", "[111px][111px][111px,grow]", "[60px][60px][60px][60px]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ lblTerminalId = new JLabel("TERMINAL ID:"); //$NON-NLS-1$ lblTerminalId.setForeground(Color.BLACK); lblTerminalId.setFont(new Font("Dialog", Font.BOLD, 18)); //$NON-NLS-1$ lblTerminalId.setHorizontalAlignment(SwingConstants.CENTER); add(lblTerminalId, BorderLayout.NORTH); bottomPanel.setLayout(new MigLayout("hidemode 3, fill")); //$NON-NLS-1$ bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(btnRegularMode); //buttonGroup.add(btnCashierMode); buttonGroup.add(btnKitchenMode); btnRegularMode.setFocusable(false); // btnCashierMode.setFocusable(false); btnKitchenMode.setFocusable(false); ModeSelectionListener l = new ModeSelectionListener(); btnRegularMode.addActionListener(l); // btnCashierMode.addActionListener(l); btnKitchenMode.addActionListener(l); btnRegularMode.setSelected(TerminalConfig.isRegularMode()); // btnCashierMode.setSelected(TerminalConfig.isCashierMode()); btnKitchenMode.setSelected(TerminalConfig.isKitchenMode()); if (!btnRegularMode.isSelected() && !btnKitchenMode.isSelected()) { btnRegularMode.setSelected(true); } JPanel modePanel = new JPanel(new GridLayout(1, 0, 2, 2)); modePanel.add(btnRegularMode); // modePanel.add(btnCashierMode); modePanel.add(btnKitchenMode); bottomPanel.add(modePanel, "h 60!, grow, wrap"); //$NON-NLS-1$ psbtnLogin = new PosButton(); psbtnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doLogin(); } }); psbtnLogin.setText("LOGIN"); //$NON-NLS-1$ bottomPanel.add(psbtnLogin, "grow, wrap, gapbottom 20px"); //$NON-NLS-1$ PosButton btnClockOUt = new PosButton(new ClockInOutAction(false, true)); bottomPanel.add(btnClockOUt, "grow, wrap, h 60!"); //$NON-NLS-1$ if (TerminalConfig.isShowDbConfigureButton()) { btnConfigureDatabase = new com.floreantpos.swing.PosButton(); btnConfigureDatabase.setAction(goAction); btnConfigureDatabase.setText(com.floreantpos.POSConstants.CONFIGURE_DATABASE); btnConfigureDatabase.setFocusable(false); btnConfigureDatabase.setActionCommand("DBCONFIG"); //$NON-NLS-1$ bottomPanel.add(btnConfigureDatabase, "grow, wrap, h 60!"); //$NON-NLS-1$ } btnShutdown.setAction(goAction); btnShutdown.setText(com.floreantpos.POSConstants.SHUTDOWN); btnShutdown.setFocusable(false); if (TerminalConfig.isFullscreenMode()) { if (btnConfigureDatabase != null) { btnConfigureDatabase.setVisible(false); } if (btnShutdown != null) { btnShutdown.setVisible(false); } } bottomPanel.add(btnShutdown, "grow, wrap, h 60!"); //$NON-NLS-1$ add(bottomPanel, BorderLayout.SOUTH); lblTerminalId.setText(""); //$NON-NLS-1$ }
From source file:FormularioGuardarEstudio.java
@SuppressWarnings({ "unchecked", "rawtypes" }) private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - verdura henrion label1 = new JLabel(); pacientesCombo = new JComboBox(obtenerPacientes().toArray()); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); nombreEstudio = new JTextField(); scrollPane1 = new JScrollPane(); descripcion = new JTextArea(); descripcion.setLineWrap(true);/*from w w w. j ava 2 s. co m*/ descripcion.setWrapStyleWord(true); notas = new JTextArea(); notas.setLineWrap(true); notas.setWrapStyleWord(true); button1 = new JButton(); mensajeRespuesta = new JLabel(); //======== this ======== setTitle("Guardar Estudio"); Container contentPane = getContentPane(); //---- label1 ---- label1.setText("Paciente:"); label1.setFont(new Font("Calibri", Font.BOLD, 14)); //---- label2 ---- label2.setText("Datos del Estudio"); label2.setFont(new Font("Calibri", Font.BOLD, 14)); //---- label3 ---- label3.setText("Nombre Del Estudio:"); //---- label4 ---- label4.setText("Descripci\u00f3n:"); //---- label5 ---- label5.setText("Notas:"); //======== scrollPane1 ======== { scrollPane1.setViewportView(descripcion); } //---- button1 ---- button1.setText("Guardar Estudio"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clickGuardarEstudio(e); } }); //---- mensajeRespuesta ---- mensajeRespuesta.setText("_"); mensajeRespuesta.setHorizontalAlignment(SwingConstants.CENTER); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup() .addContainerGap().addGroup(contentPaneLayout.createParallelGroup().addComponent(label4) .addComponent(label1, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) .addComponent( pacientesCombo, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE) .addComponent(label2) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(label3) .addGap(18, 18, 18).addComponent(nombreEstudio, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE)) .addGroup(contentPaneLayout.createSequentialGroup().addComponent(label5) .addGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup().addGap(83, 83, 83) .addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) .addComponent(notas, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))) .addGroup(contentPaneLayout.createSequentialGroup() .addGap(48, 48, 48).addComponent(mensajeRespuesta, GroupLayout.PREFERRED_SIZE, 215, GroupLayout.PREFERRED_SIZE)))))) .addGroup(contentPaneLayout.createSequentialGroup().addGap(142, 142, 142) .addComponent(button1))) .addContainerGap(18, Short.MAX_VALUE))); contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup().addContainerGap() .addComponent(label1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pacientesCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(label2).addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label3).addComponent(nombreEstudio, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label4).addComponent( scrollPane1, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label5).addComponent(notas, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(mensajeRespuesta, GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button1) .addContainerGap())); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.lfv.lanzius.server.WorkspacePanel.java
private void initComponents() { view = new WorkspaceView(server, this); toolBar = new JToolBar(Config.TITLE + " - Toolbar"); buttonServer = new JButton(); buttonLink = new JButton(); buttonLoad = new JButton(); buttonUnlink = new JButton(); buttonSwap = new JButton(); buttonMonitor = new JButton(); buttonStart = new JButton(); buttonStop = new JButton(); buttonIsaStart = new JButton(); //buttonIsaToggle = new JButton(); setLayout(new BorderLayout()); iconServerOn = new ImageIcon("data/resources/icons/Server_on.png"); iconServerOff = new ImageIcon("data/resources/icons/Server_off.png"); buttonServer.setFont(new Font("Dialog", 0, 10)); buttonServer.setIcon(iconServerOff); buttonServer.setText("Server"); buttonServer.setDisabledIcon(iconServerOff); buttonServer.setEnabled(false);//from w ww .j a v a 2s .c o m buttonServer.setFocusPainted(false); buttonServer.setHorizontalTextPosition(SwingConstants.CENTER); buttonServer.setIconTextGap(0); buttonServer.setVerticalTextPosition(SwingConstants.BOTTOM); toolBar.add(buttonServer); toolBar.addSeparator(new Dimension(40, 1)); buttonLoad.setFont(new Font("Dialog", 0, 10)); buttonLoad.setIcon(new ImageIcon("data/resources/icons/Load.png")); buttonLoad.setText("Load"); buttonLoad.setToolTipText("Load an exercise xml file"); buttonLoad.setDisabledIcon(new ImageIcon("data/resources/icons/Load_gray.png")); buttonLoad.setEnabled(false); buttonLoad.setFocusPainted(false); buttonLoad.setHorizontalTextPosition(SwingConstants.CENTER); buttonLoad.setIconTextGap(0); buttonLoad.setVerticalTextPosition(SwingConstants.BOTTOM); buttonLoad.addActionListener(this); toolBar.add(buttonLoad); toolBar.addSeparator(); buttonLink.setFont(new Font("Dialog", 0, 10)); buttonLink.setIcon(new ImageIcon("data/resources/icons/Link.png")); buttonLink.setText("Link"); buttonLink.setToolTipText("Link one or more players to the selected terminal"); buttonLink.setDisabledIcon(new ImageIcon("data/resources/icons/Link_gray.png")); buttonLink.setEnabled(false); buttonLink.setFocusPainted(false); buttonLink.setHorizontalTextPosition(SwingConstants.CENTER); buttonLink.setIconTextGap(0); buttonLink.setVerticalTextPosition(SwingConstants.BOTTOM); buttonLink.addActionListener(this); toolBar.add(buttonLink); buttonUnlink.setFont(new Font("Dialog", 0, 10)); buttonUnlink.setIcon(new ImageIcon("data/resources/icons/Unlink.png")); buttonUnlink.setText("Unlink"); buttonUnlink.setToolTipText("Unlink players from selected terminal(s) or group(s)"); buttonUnlink.setDisabledIcon(new ImageIcon("data/resources/icons/Unlink_gray.png")); buttonUnlink.setEnabled(false); buttonUnlink.setFocusPainted(false); buttonUnlink.setHorizontalTextPosition(SwingConstants.CENTER); buttonUnlink.setIconTextGap(0); buttonUnlink.setVerticalTextPosition(SwingConstants.BOTTOM); buttonUnlink.addActionListener(this); toolBar.add(buttonUnlink); buttonSwap.setFont(new Font("Dialog", 0, 10)); buttonSwap.setIcon(new ImageIcon("data/resources/icons/Swap.png")); buttonSwap.setText("Swap"); buttonSwap.setToolTipText("Swap the players linked to the two selected terminals"); buttonSwap.setDisabledIcon(new ImageIcon("data/resources/icons/Swap_gray.png")); buttonSwap.setEnabled(false); buttonSwap.setFocusPainted(false); buttonSwap.setHorizontalTextPosition(SwingConstants.CENTER); buttonSwap.setIconTextGap(0); buttonSwap.setVerticalTextPosition(SwingConstants.BOTTOM); buttonSwap.addActionListener(this); toolBar.add(buttonSwap); toolBar.addSeparator(); buttonMonitor.setFont(new Font("Dialog", 0, 10)); buttonMonitor.setIcon(new ImageIcon("data/resources/icons/Listen.png")); buttonMonitor.setText("Monitor"); buttonMonitor.setToolTipText("Listen and record the selected terminal"); buttonMonitor.setDisabledIcon(new ImageIcon("data/resources/icons/Listen_gray.png")); buttonMonitor.setEnabled(false); buttonMonitor.setFocusPainted(false); buttonMonitor.setHorizontalTextPosition(SwingConstants.CENTER); buttonMonitor.setIconTextGap(0); buttonMonitor.setVerticalTextPosition(SwingConstants.BOTTOM); buttonMonitor.addActionListener(this); toolBar.add(buttonMonitor); toolBar.addSeparator(); buttonStart.setFont(new Font("Dialog", 0, 10)); buttonStart.setIcon(new ImageIcon("data/resources/icons/Start.png")); buttonStart.setText("Start"); buttonStart.setToolTipText("Start the selected group(s)"); buttonStart.setDisabledIcon(new ImageIcon("data/resources/icons/Start_gray.png")); buttonStart.setEnabled(false); buttonStart.setFocusPainted(false); buttonStart.setHorizontalTextPosition(SwingConstants.CENTER); buttonStart.setIconTextGap(0); buttonStart.setVerticalTextPosition(SwingConstants.BOTTOM); buttonStart.addActionListener(this); toolBar.add(buttonStart); buttonStop.setFont(new Font("Dialog", 0, 10)); buttonStop.setIcon(new ImageIcon("data/resources/icons/Stop.png")); buttonStop.setText("Stop"); buttonStop.setToolTipText("Stop the selected group(s)"); buttonStop.setDisabledIcon(new ImageIcon("data/resources/icons/Stop_gray.png")); buttonStop.setEnabled(false); buttonStop.setFocusPainted(false); buttonStop.setHorizontalTextPosition(SwingConstants.CENTER); buttonStop.setIconTextGap(0); buttonStop.setVerticalTextPosition(SwingConstants.BOTTOM); buttonStop.addActionListener(this); toolBar.add(buttonStop); toolBar.addSeparator(); buttonIsaStart.setFont(new Font("Dialog", 0, 10)); buttonIsaStart.setIcon(new ImageIcon("data/resources/icons/StartISA.png")); buttonIsaStart.setText("ISA Start/Stop"); buttonIsaStart.setToolTipText("Start measure work load for selected clients"); buttonIsaStart.setDisabledIcon(new ImageIcon("data/resources/icons/StartISA_gray.png")); buttonIsaStart.setEnabled(true); buttonIsaStart.setFocusPainted(false); buttonIsaStart.setHorizontalTextPosition(SwingConstants.CENTER); buttonIsaStart.setIconTextGap(0); buttonIsaStart.setVerticalTextPosition(SwingConstants.BOTTOM); buttonIsaStart.addActionListener(this); toolBar.add(buttonIsaStart); /* buttonIsaToggle.setFont(new Font("Dialog", 0, 10)); buttonIsaToggle.setIcon(new ImageIcon("data/resources/icons/StopISA.png")); buttonIsaToggle.setText("Toggle ISA"); buttonIsaToggle.setToolTipText("Start/Stop measure work load for selected clients"); buttonIsaToggle.setDisabledIcon(new ImageIcon("data/resources/icons/StopISA_gray.png")); buttonIsaToggle.setEnabled(false); buttonIsaToggle.setFocusPainted(false); buttonIsaToggle.setHorizontalTextPosition(SwingConstants.CENTER); buttonIsaToggle.setIconTextGap(0); buttonIsaToggle.setVerticalTextPosition(SwingConstants.BOTTOM); buttonIsaToggle.addActionListener(this); toolBar.add(buttonIsaToggle); */ add(toolBar, BorderLayout.NORTH); add(view, BorderLayout.CENTER); }
From source file:king.flow.action.business.InsertCardAction.java
@Override protected void installButtonAction() { JButton btn = (JButton) this.owner; btn.addActionListener(new ActionListener() { @Override/* w ww. j av a 2 s . c om*/ public void actionPerformed(ActionEvent e) { if (cardType == DeviceEnum.GZ_CARD) { progressTip = new JLabel( getResourceMsg("operation.ic.card.insert.prompt" + "." + DeviceEnum.GZ_CARD.value())); } else { progressTip = new JLabel(getResourceMsg("operation.ic.card.insert.prompt")); } Window windowNode = getWindowNode(); UiStyle uiStyle = windowNode.getUiStyle(); if (uiStyle != null && uiStyle.getFont() != null && uiStyle.getFont().getName() != null) { progressTip.setFont(new FontUIResource(uiStyle.getFont().getName(), java.awt.Font.BOLD, 50)); } else { progressTip.setFont(new FontUIResource("Dialog", java.awt.Font.BOLD, 50)); } progressTip.setHorizontalAlignment(SwingConstants.CENTER); progressTip.setVerticalAlignment(SwingConstants.BOTTOM); final JDialog progressAnimation = buildAnimationDialog(animationFile); progressTip.setBounds(0, 120, progressAnimation.getBounds().width, 80); progressAnimation.getContentPane().add(progressTip, 1); final ImageIcon bgImage = CommonUtil.getImageIcon("/image/2.jpg"); //final ImageIcon bgImage = CommonUtil.getDefaultBackgroundImage(); if (bgImage != null) { progressAnimation.getContentPane().add(new JLabel(bgImage), 2); } else { progressAnimation.getContentPane().add(new JLabel(), 2); } switch (cardType) { case GZ_CARD: waitCommunicationTask(new GZReadCardTask(), progressAnimation); break; default: getLogger(InsertCardAction.class.getName()).log(Level.WARNING, "Unsupported card type[{0}] for InsertCardAction", cardType.name()); handleErr(getResourceMsg(GzCardConductor.GUOZHEN_CARD_OPERATION_PROMPT)); } } }); }
From source file:com.github.cmisbox.ui.BaseFrame.java
public BaseFrame() { super(AWTUtilitiesWrapper.isTranslucencyCapable(BaseFrame.gc) ? BaseFrame.gc : null); this.log = LogFactory.getLog(this.getClass()); this.gradient = false; this.setUndecorated(true); this.mainPanel = new JPanel(new GridBagLayout()) { private static final long serialVersionUID = 1035974033526970010L; protected void paintComponent(Graphics g) { if ((g instanceof Graphics2D) && BaseFrame.this.gradient) { final int R = 0; final int G = 0; final int B = 0; Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B, 192), this.getWidth(), this.getHeight(), new Color(R, G, B, 255), true); Graphics2D g2d = (Graphics2D) g; g2d.setPaint(p);/* www . j a va 2 s.co m*/ g2d.fillRect(0, 0, this.getWidth(), this.getHeight()); } else { super.paintComponent(g); } } }; this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); GridBagConstraints gbc = new GridBagConstraints(); this.mainPanel.setDoubleBuffered(false); this.mainPanel.setOpaque(false); this.mainPanel.setBorder(BorderFactory.createLineBorder(Color.white)); JLabel title = new JLabel(this.getWindowTitle(), SwingConstants.CENTER); title.setForeground(Color.white); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 100; this.mainPanel.add(title, gbc); Image closeImg = this.getImage("images/application-exit.png", 32, 32); JLabel close = new JLabel(new ImageIcon(closeImg), SwingConstants.RIGHT); gbc.fill = GridBagConstraints.NONE; gbc.gridx = 2; gbc.weightx = 0; this.mainPanel.add(close, gbc); close.addMouseListener(this.closeAdapter); this.getContentPane().add(this.mainPanel, BorderLayout.CENTER); this.initComponents(); this.pack(); this.mainPanel.setOpaque(!this.gradient); if (!this.gradient) { this.mainPanel.setBackground(new Color(0, 0, 0, 208)); } this.setLocationRelativeTo(null); AWTUtilitiesWrapper.setWindowOpaque(this, false); this.setVisible(true); this.setAlwaysOnTop(true); }
From source file:org.sbml.bargraph.MainWindow.java
/** * Creates the main application frame./*from w w w . ja va 2s . c om*/ * * @param file A file to read and graph upon start up. If null, nothing * is graphed initially. */ public MainWindow(File file) { Log.note("Creating main application window."); setPlatformProperties(); setBackground(new Color(255, 255, 255)); setMaximumSize(new Dimension(2000, 1000)); setMinimumSize(new Dimension(600, 400)); setTitle("SBML Bar Graph"); setSize(new Dimension(600, 400)); setPreferredSize(new Dimension(600, 400)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 550, 400); contentPane = new JPanel(); contentPane.setSize(new Dimension(600, 400)); contentPane.setPreferredSize(new Dimension(600, 400)); contentPane.setMinimumSize(new Dimension(600, 400)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); fileNamePanel = new JPanel(); fileNamePanel.setPreferredSize(new Dimension(590, 20)); fileNamePanel.setMinimumSize(new Dimension(590, 20)); fileNamePanel.setLayout(new BorderLayout(0, 0)); contentPane.add(fileNamePanel, BorderLayout.NORTH); fileNameField = new JTextField(); fileNameField.setHorizontalAlignment(SwingConstants.CENTER); fileNameField.setText("No file selected"); fileNameField.setDisabledTextColor(Color.LIGHT_GRAY); fileNameField.setFont(new Font("Lucida Grande", Font.ITALIC, 11)); fileNameField.setBorder(null); fileNameField.setOpaque(true); fileNameField.setBackground(UIManager.getColor("Separator.foreground")); fileNameField.setEnabled(false); fileNameField.setSize(new Dimension(590, 0)); fileNameField.setPreferredSize(new Dimension(590, 28)); fileNameField.setMinimumSize(new Dimension(590, 28)); fileNameField.setColumns(10); fileNamePanel.add(fileNameField, BorderLayout.CENTER); // The bar graph panel. chartPanel = new ChartPanel(createModelBarGraph(), false); contentPane.add(chartPanel, BorderLayout.CENTER); updatePanelForSBMLFile(file); // Manual additions for File menu. fileMenu = new JMenu(); fileMenu.setText("File"); openFileMenuItem = new JMenuItem(); openFileMenuItem .setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, shortcutKeyMask)); openFileMenuItem.setText("Open..."); openFileMenuItem.setToolTipText("Open file to be graphed"); openFileMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { openFileHandler(evt); } }); fileMenu.add(openFileMenuItem); menuBar = new javax.swing.JMenuBar(); menuBar.add(fileMenu); setJMenuBar(menuBar); // Replace the default Java window icon with our own. // This only has an effect on non-Mac OS systems. URL iconImageURL = getClass().getResource(Config.RES_ICON_APP); Toolkit toolkit = Toolkit.getDefaultToolkit(); Image img = toolkit.createImage(iconImageURL); setIconImage(img); Log.note("Finished constructing panel and menu bar"); }
From source file:net.vanosten.dings.swing.SummaryView.java
private void initComponents() { chartP = new JPanel(); chartP.setLayout(new BorderLayout()); //to begin with we show an information JLabel infoL = new JLabel( "Choose the chart type belwo and press the \"Update View\" button to show statistics."); infoL.setEnabled(false); //only for display infoL.setHorizontalAlignment(SwingConstants.CENTER); chartP.add(infoL, BorderLayout.CENTER); Vector<String> items = new Vector<String>(); items.add("Entries by " + Toolbox.getInstance().getInfoPointer().getUnitLabel()); items.add("Entries by " + Toolbox.getInstance().getInfoPointer().getCategoryLabel()); items.add("Entries by Entry Type"); items.add("Entries by Score"); items.add("Entry Scores over Time"); //do not change sequence of elements, as showGraph() and checkChosenStattype rely on it chartTypeCB = new JComboBox(items); chartTypeCB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (4 == chartTypeCB.getSelectedIndex()) { chosenCB.setEnabled(false); } else { chosenCB.setEnabled(true); }//from ww w .j a va 2s . com } }); chosenCB = new JCheckBox("Only Selected Entries", false); chosenCB.setMnemonic("O".charAt(0)); }
From source file:com.sshtools.common.ui.OptionsPanel.java
/** * * * @param parent//from w w w. j a v a2 s.co m * @param tabs tabs * * @return */ public static boolean showOptionsDialog(Component parent, OptionsTab[] tabs) { final OptionsPanel opts = new OptionsPanel(tabs); opts.reset(); JDialog d = null; Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, parent); if (w instanceof JDialog) { d = new JDialog((JDialog) w, "Options", true); } else if (w instanceof JFrame) { d = new JDialog((JFrame) w, "Options", true); } else { d = new JDialog((JFrame) null, "Options", true); } final JDialog dialog = d; // Create the bottom button panel final JButton cancel = new JButton("Cancel"); cancel.setMnemonic('c'); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { opts.cancelled = true; dialog.setVisible(false); } }); final JButton ok = new JButton("Ok"); ok.setMnemonic('o'); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (opts.validateTabs()) { dialog.setVisible(false); } } }); dialog.getRootPane().setDefaultButton(ok); JPanel buttonPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(6, 6, 0, 0); gbc.weighty = 1.0; UIUtil.jGridBagAdd(buttonPanel, ok, gbc, GridBagConstraints.RELATIVE); UIUtil.jGridBagAdd(buttonPanel, cancel, gbc, GridBagConstraints.REMAINDER); JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); southPanel.add(buttonPanel); // JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPanel.add(opts, BorderLayout.CENTER); mainPanel.add(southPanel, BorderLayout.SOUTH); // Show the dialog dialog.getContentPane().setLayout(new GridLayout(1, 1)); dialog.getContentPane().add(mainPanel); dialog.pack(); dialog.setResizable(true); UIUtil.positionComponent(SwingConstants.CENTER, dialog); dialog.setVisible(true); if (!opts.cancelled) { opts.applyTabs(); } return !opts.cancelled; }