@Override public void create(final MagicPanel $main, final MagicPanel $parent) { if ($height == null) { $height = new Value("27px"); } int $align = SwingConstants.LEFT; if ("right".equals($textAlign)) { $align = SwingConstants.RIGHT; } else if ("center".equals($textAlign)) { $align = SwingConstants.CENTER; } JLabel $c = new JLabel($text.trim(), $align); if ("top".equals($verticalAlignment)) { $c.setVerticalAlignment(SwingConstants.TOP); } else if ("bottom".equals($verticalAlignment)) { $c.setVerticalAlignment(SwingConstants.BOTTOM); } if (($background != null) && ($opaque == null)) { $opaque = true; } $component = $c; $realComponent = $c; super.create($main, $parent); }
public TransactionPanel() { setLayout(new GridLayout(2, 1)); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, DARK_CHAMPAGNE)); listModel.removeAllElements(); readTransactions(); receiptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); titleLabel.setVerticalAlignment(SwingConstants.TOP); titleLabel.setFont(new Font(Font.SERIF, Font.BOLD, 24)); listLabel.setVerticalAlignment(SwingConstants.BOTTOM); listLabel.setFont(new Font(Font.SERIF, Font.ITALIC, 18)); buttonPanel.setBackground(DARK_CHAMPAGNE); buttonPanel.add(new MenuButton("Load", "Load", this)); // buttonPanel.add(new MenuButton("Delete","Delete",this)); // buttonPanel.add(new MenuButton("Void", "Void", this)); // buttonPanel.add(new MenuButton("Delete All","Delete All",this)); buttonPanel.add(new MenuButton("Print", "Print", this)); Tools.addBlankSpace(buttonPanel, 2); upperPanel.setBackground(DARK_CHAMPAGNE); upperPanel.add(titleLabel); upperPanel.add(buttonPanel); upperPanel.add(listLabel); add(upperPanel); add( new JScrollPane( receiptList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS)); }
public void updateWindow(int number, ImageIcon pic1) { switch (number) { case 1: jLabel1.setIcon(pic1); jLabel1.setHorizontalAlignment(jLabel1.CENTER); jLabel1.setVerticalAlignment(jLabel1.CENTER); jLabel1.removeMouseListener(this); break; case 2: jLabel2.setIcon(pic1); jLabel2.setHorizontalAlignment(jLabel1.CENTER); jLabel2.setVerticalAlignment(jLabel1.CENTER); jLabel2.removeMouseListener(this); break; case 3: jLabel3.setIcon(pic1); jLabel3.setHorizontalAlignment(jLabel1.CENTER); jLabel3.setVerticalAlignment(jLabel1.CENTER); jLabel3.removeMouseListener(this); break; case 4: jLabel4.setIcon(pic1); jLabel4.setHorizontalAlignment(jLabel1.CENTER); jLabel4.setVerticalAlignment(jLabel1.CENTER); jLabel4.removeMouseListener(this); break; case 5: jLabel5.setIcon(pic1); jLabel5.setHorizontalAlignment(jLabel1.CENTER); jLabel5.setVerticalAlignment(jLabel1.CENTER); jLabel5.removeMouseListener(this); break; case 6: jLabel6.setIcon(pic1); jLabel6.setHorizontalAlignment(jLabel1.CENTER); jLabel6.setVerticalAlignment(jLabel1.CENTER); jLabel6.removeMouseListener(this); break; case 7: jLabel7.setIcon(pic1); jLabel7.setHorizontalAlignment(jLabel1.CENTER); jLabel7.setVerticalAlignment(jLabel1.CENTER); jLabel7.removeMouseListener(this); break; case 8: jLabel8.setIcon(pic1); jLabel8.setHorizontalAlignment(jLabel1.CENTER); jLabel8.setVerticalAlignment(jLabel1.CENTER); jLabel8.removeMouseListener(this); break; case 9: jLabel9.setIcon(pic1); jLabel9.setHorizontalAlignment(jLabel1.CENTER); jLabel9.setVerticalAlignment(jLabel1.CENTER); jLabel9.removeMouseListener(this); } }
private void addRow(String name, Component editor, Field field) { JLabel label = new JLabel(name + ":", JLabel.TRAILING); label.setVerticalAlignment(JLabel.TOP); genericTagPropertiesEditPanel.add(label); label.setLabelFor(editor); labels.put(name, label); genericTagPropertiesEditPanel.add(editor); JLabel typeLabel = new JLabel(swfTypeToString(field.getAnnotation(SWFType.class)), JLabel.TRAILING); typeLabel.setVerticalAlignment(JLabel.TOP); genericTagPropertiesEditPanel.add(typeLabel); types.put(name, typeLabel); keys.add(name); }
/** * Default constructor * * @param playerName The player name * @param isReplay If true, this is a replay */ public PlayerInfoView(Player player, boolean isReplay) { _player = player; this.setPreferredSize(new Dimension(COMPONENT_WIDTH, COMPONENT_HEIGHT)); _isBlack = player.getColor(); _playerNameLabel = new JLabel(player.getPlayer().getPseudo()); _timerLabel = new JLabel(normalizeTime(player.getTimer())); JLayeredPane layeredPane = new JLayeredPane(); // Background JLabel background = new JLabel( new ImageIcon(LobbyConstant.chargeFichier("fr/utc/ressources/player_info_bg.png"))); background.setBounds(0, 0, COMPONENT_WIDTH, COMPONENT_HEIGHT); // Player label _playerNameLabel.setFont(new Font("Georgia", Font.BOLD, 33)); _playerNameLabel.setForeground(_isBlack ? Color.black : Color.white); _playerNameLabel.setHorizontalAlignment(JLabel.CENTER); // 0 = no timer if (player.getTimer() == -1 || isReplay) { _playerNameLabel.setVerticalAlignment(JLabel.CENTER); _playerNameLabel.setBounds(15, 0, COMPONENT_WIDTH - 30, COMPONENT_HEIGHT); } else { _playerNameLabel.setVerticalAlignment(JLabel.TOP); _playerNameLabel.setBounds(15, 35, COMPONENT_WIDTH - 30, COMPONENT_HEIGHT); _timerLabel.setVerticalAlignment(JLabel.TOP); _timerLabel.setHorizontalAlignment(JLabel.CENTER); _timerLabel.setFont(new Font("Georgia", Font.BOLD, 28)); _timerLabel.setForeground(new Color(137, 78, 33)); _timerLabel.setBounds(0, 80, COMPONENT_WIDTH, COMPONENT_HEIGHT); layeredPane.add(_timerLabel, JLayeredPane.DEFAULT_LAYER); this.initTimer(); } layeredPane.add(_playerNameLabel, JLayeredPane.DEFAULT_LAYER); layeredPane.add(background, JLayeredPane.DEFAULT_LAYER); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(layeredPane, GroupLayout.DEFAULT_SIZE, COMPONENT_WIDTH, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent( layeredPane, GroupLayout.DEFAULT_SIZE, COMPONENT_HEIGHT, Short.MAX_VALUE)); }
public GUITable() throws Exception { main_frame = new JFrame("Card Games"); main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main_frame.setPreferredSize(new Dimension(357, 323)); main_frame.setResizable(false); main_menu = new TableMenu(); main_frame.setJMenuBar(main_menu); Container cp = main_frame.getContentPane(); cp.setLayout(new CardLayout()); JLabel base = new JLabel("Use the game menu to start a game"); base.setHorizontalAlignment(SwingConstants.CENTER); base.setVerticalAlignment(SwingConstants.CENTER); cp.add(base, "Base"); base.setSize(cp.getSize()); main_frame.pack(); main_frame.setVisible(true); game_gui = null; games = new Hashtable<String, TableUI>(); this.host = GUIPlayer.getCurrentPlayer(); if (this.host == null) { main_menu.showNewUserDialog(main_frame); this.host = GUIPlayer.getCurrentPlayer(); if (this.host != null) main_menu.enableGameMenus(); } else main_menu.enableGameMenus(); }
public PanelInfo() { super("程序介绍"); String string = new String(); string = "<html>本程序主要分四个板块功能:<br/>" + "<br/><br/>" + "一、简谐振动方程:" + "<br/><br/>" + " 1、 输入方程参数; 2、输出方程函数值; 3、查看图表;" + "<br/><br/><br/>" + "二、绘图:" + "<br/><br/>" + " 1、绘制方程结果集图像;" + "<br/><br/><br/>" + "三、文件操作:" + "<br/><br/>" + " 1、保存数据文件; 2、拷贝文件;" + "<br/><br/><br/>" + "四、数据库操作:" + "<br/><br/>" + " 1、保存数据到数据库; 2、从数据库读取数据;" + "<br/><br/><br/>" + "本程序基本已覆盖绝大部分要求,希望老师直接以本次报告作为平时作业与实验的成绩参考依据。" + "<br/>" + "大连理工大学,管理与经济学部,双管信1502,201597151,梁子山。" + "</html>"; JLabel lblContent = new MyLabel(string, true, Constant.CONTENT_X, Constant.CONTENT_Y); // 初始化 lblContent.setSize(Constant.CONTENT_WIDTH, Constant.CONTENT_HEIGHT); // 设置 大小 lblContent.setVerticalAlignment(SwingConstants.TOP); // 设置 顶端对齐 this.add(lblContent); }
protected void AddAndword(String Letter, String Andwoord, Color Kleur) { javax.swing.JLabel lbl; javax.swing.JPanel pnl; javax.swing.JToggleButton tcmd; pnl = new javax.swing.JPanel(); tcmd = new javax.swing.JToggleButton(); lbl = new javax.swing.JLabel(); pnl.setBackground(Kleur); pnl.setBorder(javax.swing.BorderFactory.createEtchedBorder()); tcmd.setFont(new java.awt.Font("DejaVu Sans", 1, 36)); lbl.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); tcmd.setText(Letter); tcmd.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); tcmd.setMaximumSize(new java.awt.Dimension(30, 30)); tcmd.setMinimumSize(new java.awt.Dimension(30, 30)); tcmd.setPreferredSize(new java.awt.Dimension(30, 30)); lbl.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); lbl.setVerticalAlignment(javax.swing.SwingConstants.TOP); lbl.setText(Andwoord); lbl.setBorder(null); javax.swing.GroupLayout pnlALayout = new javax.swing.GroupLayout(pnl); pnl.setLayout(pnlALayout); pnlALayout.setHorizontalGroup( pnlALayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( pnlALayout .createSequentialGroup() .addComponent( tcmd, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( lbl, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE))); pnlALayout.setVerticalGroup( pnlALayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( pnlALayout .createSequentialGroup() .addComponent( tcmd, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(32, Short.MAX_VALUE)) .addComponent(lbl, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)); Antwoorde.add(pnl); }
private void show(int _current) { OpenDefinitionsDocument doc = _docs.get(_current); String text = getTextFor(doc); _label.setText(_displayManager.getName(doc)); _label.setIcon(_displayManager.getIcon(doc)); if (text.length() > 0) { // as wide as the text area wants, but only 200px high _textpane.setText(text); _scroller.setPreferredSize(_textpane.getPreferredScrollableViewportSize()); if (_scroller.getPreferredSize().getHeight() > 200) _scroller.setPreferredSize( new Dimension((int) _scroller.getPreferredSize().getWidth(), 200)); _scroller.setVisible(_showSource); } else _scroller.setVisible(false); Dimension d = _label.getMinimumSize(); d.setSize(d.getWidth() + _padding * 2, d.getHeight() + _padding * 2); _label.setPreferredSize(d); _label.setHorizontalAlignment(SwingConstants.CENTER); _label.setVerticalAlignment(SwingConstants.CENTER); pack(); centerH(); }
protected JComponent getNewComponentInstance() { JLabel newLabel = new JLabel() { /** */ private static final long serialVersionUID = 1L; /* (non-Javadoc) * @see javax.swing.JComponent#paintComponent(java.awt.Graphics) */ @Override protected void paintComponent(Graphics g) { Insets i = getInsets(); Rectangle rect = new Rectangle( i.left, i.top, getWidth() - i.left - i.right, getHeight() - i.top - i.bottom); Area clip = new Area(g.getClip()); clip.intersect(new Area(rect)); Graphics2D g2 = (Graphics2D) g; g2.setClip(clip); super.paintComponent(g); } }; newLabel.setPreferredSize(itemSize); newLabel.setMinimumSize(scaleItem ? small : itemSize); newLabel.setMaximumSize(scaleItem ? large : itemSize); newLabel.setBorder(componentBorder); newLabel.setText(""); newLabel.setHorizontalAlignment(JLabel.CENTER); newLabel.setVerticalAlignment(JLabel.CENTER); return newLabel; }
public JImage() { setOpaque(false); setLayout(new BorderLayout(0, 0)); imageLabel = new JLabel(""); imageLabel.setVerticalAlignment(JLabel.CENTER); imageLabel.setHorizontalAlignment(JLabel.CENTER); imageLabel.setIcon(LOADING_ICON); imageLabel.addMouseListener( new MouseAdapter() { public void mouseEntered(MouseEvent e) { onMouseEntered(e); } public void mouseExited(MouseEvent e) { onMouseExited(e); } public void mousePressed(MouseEvent e) { onMousePressed(e); } public void mouseReleased(MouseEvent e) { onMouseReleased(e); } }); add(imageLabel, BorderLayout.CENTER); }
/** * Maybe a lengthy operation depending on the passed in Runnable. * * @param resultCode * @param cliOutputLines * @param cliErrorLines */ @Override public void cliProcessCompleted( final int resultCode, final String[] cliOutputLines, final String[] cliErrorLines) { if (cliErrorLines.length != 0) { final JLabel jLabel_Error = new JLabel(); jLabel_Error.setForeground(Color.RED); jLabel_Error.setOpaque( true); // BorderLayout functions as a NullLayout inside each compass constraint jLabel_Error.setText("<HTML>" + StringsUtil_.concatenate("<BR>", cliErrorLines)); jLabel_Error.setVerticalAlignment(JLabel.TOP); fWindowToClose.add(jLabel_Error, BorderLayout.WEST); } jProgressBar.setVisible(false); ab_Done.setText("OK"); ab_Done.setEnabled(true); ab_Done.requestFocusInWindow(); // hilite it final Thread postProcessCompletionThread = new Thread( new Runnable() // anonymous class { @Override public void run() { // cause notification fResultCodeCompletionCallback.listen(resultCode); // autobox } }, this.getClass().getCanonicalName()); postProcessCompletionThread .start(); // runs completion in another thread so Swing can update the pending JList paint }
public void setPathwayPanelText(String text) { pathwayPanel.removeAll(); JLabel label = new JLabel(text, JLabel.LEFT); label.setVerticalAlignment(JLabel.TOP); pathwayPanel.setLayout(new BorderLayout()); pathwayPanel.add(label, BorderLayout.CENTER); pathwayPanel.revalidate(); }
MessagePanel() { super(new BorderLayout()); myLabel = new JLabel(); myLabel.setForeground(UIUtil.getInactiveTextColor()); myLabel.setHorizontalAlignment(SwingConstants.CENTER); myLabel.setVerticalAlignment(SwingConstants.CENTER); add(myLabel); }
private void calculationsPanel() { JPanel calculationsPanel = new JPanel(); JScrollPane calculationsScrollPanel = new JScrollPane(calculationsPanel); masterPanel.add(calculationsScrollPanel, CALCULATIONSPANEL); calculationsPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); calculationsText.setVerticalAlignment(SwingConstants.TOP); calculationsText.setHorizontalAlignment(SwingConstants.LEFT); calculationsPanel.add(calculationsText); }
private void initUI() { myLeftPanel = new NonOpaquePanel(new BorderLayout()); myLeftPanel.add(mySearchFieldWrapper = new Wrapper(), BorderLayout.NORTH); myLeftPanel.add(myReplaceFieldWrapper = new Wrapper(), BorderLayout.CENTER); updateSearchComponent(); updateReplaceComponent(); initSearchToolbars(); initReplaceToolBars(); Wrapper searchToolbarWrapper1 = new NonOpaquePanel(new BorderLayout()); searchToolbarWrapper1.add(mySearchActionsToolbar1, BorderLayout.WEST); Wrapper searchToolbarWrapper2 = new Wrapper(mySearchActionsToolbar2); JPanel searchPair = new NonOpaquePanel(new BorderLayout()).setVerticalSizeReferent(mySearchFieldWrapper); searchPair.add(mySearchActionsToolbar1, BorderLayout.WEST); searchPair.add(searchToolbarWrapper2, BorderLayout.CENTER); JLabel closeLabel = new JLabel(null, AllIcons.Actions.Cross, SwingConstants.RIGHT); closeLabel.setBorder(JBUI.Borders.empty(5, 5, 5, 5)); closeLabel.setVerticalAlignment(SwingConstants.TOP); closeLabel.addMouseListener( new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { close(); } }); closeLabel.setToolTipText("Close search bar (Escape)"); searchPair.add(new Wrapper.North(closeLabel), BorderLayout.EAST); Wrapper replaceToolbarWrapper1 = new Wrapper(myReplaceActionsToolbar1).setVerticalSizeReferent(myReplaceFieldWrapper); Wrapper replaceToolbarWrapper2 = new Wrapper(myReplaceActionsToolbar2).setVerticalSizeReferent(myReplaceFieldWrapper); myReplaceToolbarWrapper = new NonOpaquePanel(new BorderLayout()); myReplaceToolbarWrapper.add(replaceToolbarWrapper1, BorderLayout.WEST); myReplaceToolbarWrapper.add(replaceToolbarWrapper2, BorderLayout.CENTER); searchToolbarWrapper1.setHorizontalSizeReferent(replaceToolbarWrapper1); myRightPanel = new NonOpaquePanel(new BorderLayout()); myRightPanel.add(searchPair, BorderLayout.NORTH); myRightPanel.add(myReplaceToolbarWrapper, BorderLayout.CENTER); OnePixelSplitter splitter = new OnePixelSplitter(false, .25F); splitter.setFirstComponent(myLeftPanel); splitter.setSecondComponent(myRightPanel); splitter.setHonorComponentsMinimumSize(true); splitter.setAndLoadSplitterProportionKey("FindSplitterProportion"); splitter.setOpaque(false); splitter.getDivider().setOpaque(false); add(splitter, BorderLayout.CENTER); }
// Create and set up a colored label. private JLabel createColoredLabel(String text, Color color) { JLabel label = new JLabel(text); label.setVerticalAlignment(JLabel.TOP); label.setHorizontalAlignment(JLabel.CENTER); label.setOpaque(true); label.setBackground(color); label.setForeground(Color.black); label.setBorder(BorderFactory.createLineBorder(Color.black)); label.setPreferredSize(new Dimension(140, 140)); return label; }
public final JLabel getOdometer() { if (odometer == null) { odometer = new JLabel(); odometer.setVerticalAlignment(SwingConstants.CENTER); odometer.setHorizontalAlignment(SwingConstants.LEFT); odometer.setText(" "); addMouseListener(this); addMouseMotionListener(this); } return odometer; }
/** * Creates and adds a JLabel representing the icon returned from <code>getIcon</code> to <code>top * </code>. This is messaged from <code>createMessageArea</code> */ protected void addIcon(Container top) { /* Create the icon. */ Icon sideIcon = getIcon(); if (sideIcon != null) { JLabel iconLabel = new JLabel(sideIcon); iconLabel.setName("OptionPane.iconLabel"); iconLabel.setVerticalAlignment(SwingConstants.TOP); top.add(iconLabel, BorderLayout.BEFORE_LINE_BEGINS); } }
@Override public Component getTableCellRendererComponent( final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { if (cellComponent == null) { cellComponent = (JLabel) super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); cellComponent.setText(""); cellComponent.setHorizontalAlignment(SwingConstants.CENTER); cellComponent.setVerticalAlignment(SwingConstants.CENTER); } setBackground(table, isSelected); final String boundaryString; if (value instanceof PropertyMap) { final PropertyMap propertyMap = (PropertyMap) value; boundaryString = propertyMap.getPropertyString(KEY_BOUNDARY_PATH, null); } else { boundaryString = null; } final GeneralPath[] geoBoundaryPathes = createGeoBoundaryPathes(boundaryString); if (geoBoundaryPathes.length > 0) { final BufferedImage worldMapImage = wmPainter.createWorldMapImage(geoBoundaryPathes); final Image scaledWorldMap = worldMapImage.getScaledInstance(cellWidth, -1, Image.SCALE_DEFAULT); cellComponent.setIcon(new ImageIcon(scaledWorldMap)); cellComponent.setText(""); adjustCellHeight(table, row); } else { cellComponent.setIcon(null); if (value == null) { cellComponent.setText(""); } else { cellComponent.setText("Location not available!"); } } return cellComponent; }
private Component crearPanelDescripcion() { JPanel panel = new JPanel(new GridLayout(1, 1)); panel.setPreferredSize(new Dimension(0, 50)); panel.setBorder(BorderFactory.createLoweredBevelBorder()); textoDescripcion = new JLabel(" "); textoDescripcion.setHorizontalAlignment(SwingConstants.CENTER); textoDescripcion.setVerticalAlignment(SwingConstants.CENTER); panel.add(textoDescripcion); return panel; }
private Component crearPanelImagen() { JPanel panel = new JPanel(new GridLayout(1, 1)); panel.setBorder(BorderFactory.createLoweredBevelBorder()); pantallaImagen = new JLabel(); pantallaImagen.setHorizontalAlignment(JLabel.CENTER); pantallaImagen.setVerticalAlignment(JLabel.CENTER); panel.add(pantallaImagen); return panel; }
public JLabelComboBoxComponent2(String lable, JComboBox box, int width) { this.setLayout(Util.FlowLayout(FlowLayout.LEFT)); JLabel label = new JLabel(lable); label.setVerticalAlignment(JLabel.TOP); dimension = new Dimension(width, 25); this.box = box; this.setBoxSize(dimension); this.add(label); this.add(box); this.setCursor(Util.CURSOR_DEFAULT); }
private void initTopPanel() { _topPanel = new JPanel(); FlowLayout fl__topPanel = (FlowLayout) _topPanel.getLayout(); fl__topPanel.setHgap(0); fl__topPanel.setVgap(0); fl__topPanel.setAlignment(FlowLayout.LEFT); add(_topPanel, BorderLayout.NORTH); _lblRunParamaters = new JLabel("Neural Network Training - Run Parameters"); _lblRunParamaters.setVerticalAlignment(SwingConstants.TOP); _topPanel.add(_lblRunParamaters); }
@Override public void actionPerformed(ActionEvent e) { setResizable(false); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); add(contentPane); contentPane.setLayout(null); JLabel credits = new JLabel(); credits.setBounds(25, 25, 400, 170); credits.setText( "<html>VCellID for ImageJ<br/>Version 1.0<br/>by Alejandro Petit and Gisela de la Villa</html>"); credits.setVerticalAlignment(SwingConstants.CENTER); credits.setHorizontalAlignment(SwingConstants.CENTER); contentPane.add(credits); JLabel lblForMoreHelp = new JLabel("For more help on CellID options visit:"); lblForMoreHelp.setBounds(10, 193, 422, 14); contentPane.add(lblForMoreHelp); JButton button = new JButton("Link"); button.setBounds(50, 218, 350, 23); final URI uri; try { uri = new URI("http://ip138.qb.fcen.uba.ar/embnet/Cell-ID-Rcell/Cell-ID-main.htm"); button.setText("Cell-ID Online Help"); button.setHorizontalAlignment(SwingConstants.CENTER); button.setBorderPainted(false); button.setOpaque(false); button.setBackground(Color.lightGray); button.setForeground(Color.BLUE); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try { desktop.browse(uri); } catch (Exception ex) { } } else { } } }); contentPane.add(button); } catch (URISyntaxException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } setVisible(true); }
private void initBottomPanel() { _bottomPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) _bottomPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); flowLayout.setAlignment(FlowLayout.LEFT); add(_bottomPanel, BorderLayout.SOUTH); _lblDefSSE = new JLabel("SSE* = Sum of Squared Error"); _lblDefSSE.setHorizontalAlignment(SwingConstants.LEFT); _lblDefSSE.setVerticalAlignment(SwingConstants.TOP); _bottomPanel.add(_lblDefSSE); }
public static void showCashReturn(String text, String title) { if (instance != null) { dialog = new JDialog(instance, title, false); JLabel label = new JLabel(text); label.setFont(label.getFont().deriveFont(Font.BOLD, 20)); label.setHorizontalAlignment(SwingConstants.CENTER); label.setVerticalAlignment(SwingConstants.CENTER); dialog.getContentPane().add(label); dialog.setSize(Math.max(instance.getWidth() / 2, 200), 100); dialog.setLocationRelativeTo(instance); dialog.setVisible(true); } }
private void initComponents() { LoadScreen.Update("Locaties instellen", 10); lblTitle = new javax.swing.JLabel(); Vraag = new javax.swing.JPanel(); lblVraag = new javax.swing.JLabel(); pbTime = new javax.swing.JProgressBar(); Antwoorde = new javax.swing.JPanel(); // setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setAlwaysOnTop(true); setUndecorated(true); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); lblTitle.setText("{%TITLE}"); getContentPane().add(lblTitle, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1)); Vraag.setBackground(new Color(0, 0, 128)); lblVraag.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N lblVraag.setForeground(new Color(255, 255, 0)); lblVraag.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); lblVraag.setVerticalAlignment(javax.swing.SwingConstants.TOP); lblVraag.setText("{%VRAAG}"); lblVraag.setBorder(null); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); getContentPane() .add(Vraag, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 15, dim.width, 200)); lblVraag.setLocation(0, 0); lblVraag.setSize(Vraag.getSize()); lblVraag.setVisible(true); Vraag.setAlignmentX(javax.swing.SwingConstants.LEFT); Vraag.add(lblVraag); Antwoorde.setBackground(new java.awt.Color(200, 200, 100)); Antwoorde.setLayout(new java.awt.GridLayout(3, 2, 5, 5)); getContentPane() .add( Antwoorde, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, dim.height - 300, dim.width, 300)); // pack(); // Vraag.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); this.setLocation(0, 0); this.setSize(dim); }
private static JLabel createArrow(final ActionLink link) { JLabel arrow = new JLabel(AllIcons.General.Combo3); arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); arrow.setVerticalAlignment(SwingConstants.BOTTOM); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { final MouseEvent newEvent = MouseEventAdapter.convert(e, link, e.getX(), e.getY()); link.doClick(newEvent); return true; } }.installOn(arrow); return arrow; }
public BaseGoogleLoginUI(@NotNull String signinText) { setLayout(new GridBagLayout()); setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT)); setOpaque(false); JLabel googleIcon = new JBLabel(); setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15)); googleIcon.setHorizontalAlignment(SwingConstants.CENTER); googleIcon.setVerticalAlignment(SwingConstants.CENTER); googleIcon.setOpaque(false); googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO); googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.weighty = 0; add(googleIcon, c); JTextArea signinTextArea = new JTextArea(); signinTextArea.setFont(UIUtil.getLabelFont()); signinTextArea.setLineWrap(true); signinTextArea.setWrapStyleWord(true); signinTextArea.setOpaque(false); signinTextArea.setText(signinText); c.gridx = 0; c.gridy = 1; c.weighty = 1; c.gridwidth = 2; c.weightx = 1; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; add(signinTextArea, c); }