當前位置: 首頁>>代碼示例>>Java>>正文


Java JLabel.CENTER屬性代碼示例

本文整理匯總了Java中javax.swing.JLabel.CENTER屬性的典型用法代碼示例。如果您正苦於以下問題:Java JLabel.CENTER屬性的具體用法?Java JLabel.CENTER怎麽用?Java JLabel.CENTER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.CENTER屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DayLabel

public DayLabel(Calendar cal){
    super(""+cal.get(Calendar.DAY_OF_MONTH), JLabel.CENTER);
    this.year = cal.get(Calendar.YEAR);
    this.month = cal.get(Calendar.MONTH);
    this.day = cal.get(Calendar.DAY_OF_MONTH);
    
    this.setFont(font);
    this.addMouseListener(this);
    this.addMouseMotionListener(this);
    if(month == calendar.get(Calendar.MONTH)) this.setForeground(java.awt.Color.BLACK);
    else this.setForeground(java.awt.Color.LIGHT_GRAY);
    
}
 
開發者ID:sivanWu0222,項目名稱:SimpleERP,代碼行數:13,代碼來源:Chooser.java

示例2: FlyingToolTip

public FlyingToolTip(final FlyingToolTipListener source) {
    this.source = source;
    label = new JLabel("test", JLabel.CENTER) {
        @Override
        public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D) g.create();
            int w = getWidth(), h = getHeight();
            g.setColor(getBackground());
            g.fillRect(0,0,w,h);

            if (path != null) {                    
                g2.setStroke(new BasicStroke(4f));
                g2.setColor(getForeground());
                g2.draw(path);
            }
            setOpaque(false);
            super.paintComponent(g2);
            setOpaque(true);
            g2.dispose();
        }
    };    
    label.setBorder(new EmptyBorder(2,4,10,4));
    label.setOpaque(true);
}
 
開發者ID:iapafoto,項目名稱:DicomViewer,代碼行數:24,代碼來源:FlyingToolTip.java

示例3: init

private void init() {
        initComponents();
        detailsPanel = new JPanel(new GridLayout(1, 1));
        Color color = Utils.getTextBackground();
        detailsPanel.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue()));
        lblEmptyDetails = new JLabel(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_EmptyDetails"), JLabel.CENTER);
        lblEmptyDetails.setFont(italicFont);
        lblEmptyDetails.setEnabled(false);

        JScrollPane scrollPane = new JScrollPane(detailsPanel);
        splitPane.setRightComponent(scrollPane);

        toolBar.setFocusable(false);
        toolBar.setFloatable(false);
        btnSearch = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find16.png", true));
        btnSearch.setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_SearchToolTip"));
        btnSearch.setFocusable(false);
        btnSearch.setSelected(NotificationSettings.isSearchVisible());
        //TODO delete 2 lines then quick search API clear text correctly
//        btnSearch.setToolTipText("Disabled due to Quick Search API defects");
//        btnSearch.setEnabled(false);
        btnSearch.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSearchVisible(btnSearch.isSelected());
            }
        });
        toolBar.add(btnSearch);
        toolBar.add(new FiltersMenuButton(notificationManager.getActiveFilter()));

        initLeft();
        showDetails();
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:NotificationCenterTopComponent.java

示例4: BlinkingLabel

BlinkingLabel() {
    super(getHumanKeyStrokeText(keyStroke), JLabel.CENTER);

    setOpaque(false);
    setBorder(Utility.TRIVIAL_LINE_BORDER);
    addKeyListener(this);
    addMouseListener(this);
}
 
開發者ID:wintertime,項目名稱:FreeCol,代碼行數:8,代碼來源:FreeColActionUI.java

示例5: PlaceholderPanel

PlaceholderPanel(String className) {
    super(null);
    
    putClientProperty("className", className);
    
    setOpaque(true);
    setBorder(BorderFactory.createLineBorder(LINE));
    
    label = new JLabel(BrowserUtils.getSimpleType(className), JLabel.CENTER);
    label.setOpaque(true);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:Utils.java

示例6: WizardDialog

@SuppressWarnings("LeakingThisInConstructor")
WizardDialog(JFrame frame, boolean modal) {
    super(frame, "Embedded JFileChooser Demo", modal);

    cardLayout = new CardLayout();
    cardPanel = new JPanel(cardLayout);
    getContentPane().add(cardPanel, BorderLayout.CENTER);

    messageLabel = new JLabel("", JLabel.CENTER);
    cardPanel.add(chooser, "fileChooser");
    cardPanel.add(messageLabel, "label");
    cardLayout.show(cardPanel, "fileChooser");
    chooser.addActionListener(this);

    JPanel buttonPanel = new JPanel();
    backButton = new JButton("< Back");
    nextButton = new JButton("Next >");
    closeButton = new JButton("Close");

    buttonPanel.add(backButton);
    buttonPanel.add(nextButton);
    buttonPanel.add(closeButton);

    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    backButton.setEnabled(false);
    getRootPane().setDefaultButton(nextButton);

    backButton.addActionListener(this);
    nextButton.addActionListener(this);
    closeButton.addActionListener(this);

    pack();
    setLocationRelativeTo(frame);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:35,代碼來源:FileChooserDemo.java

示例7: addCompForBorder

void addCompForBorder(Border border, String description, Container container) {
    JPanel comp = new JPanel(new GridLayout(1, 1), false);
    JLabel label = new JLabel(description, JLabel.CENTER);
    comp.add(label);
    comp.setBorder(border);

    container.add(Box.createRigidArea(new Dimension(0, 10)));
    container.add(comp);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:BorderDemo.java

示例8: init

private void init() {
    setOpaque(false);
    congelado = new Congelado();
    heroi = new JLabel(imagemHeroi, JLabel.CENTER);
    animacao = new Animacao(hero);
    add(animacao, new AbsoluteConstraints(0, 0, imagemHeroi.getIconWidth(), imagemHeroi.getIconHeight()));
    add(congelado, AbsolutesConstraints.ZERO);
    add(heroi, AbsolutesConstraints.ZERO);
}
 
開發者ID:limagiran,項目名稱:hearthstone,代碼行數:9,代碼來源:PanelHeroi.java

示例9: ActionPane

public ActionPane() {
	this.setLayout(new BorderLayout());
	this.actions = new JPanel();
	setBorder(BorderFactory.createLineBorder(Color.black));

	JLabel label1 = new JLabel(" Possible Actions ", null, JLabel.CENTER);
	add(label1, BorderLayout.NORTH);

	actionsScrollPane = new JScrollPane(this.actions);
	this.actions.setLayout(new BoxLayout(this.actions, BoxLayout.Y_AXIS));
	this.add(actionsScrollPane, BorderLayout.CENTER);
	// this.add(this.actions);

	// this.add(this.panel);
}
 
開發者ID:tslaats,項目名稱:SE2017-Team2,代碼行數:15,代碼來源:ActionPane.java

示例10: JLabelMaoDefault

/**
 * Cria um JLabel padrão para a exibição de um card na mão do jogador
 *
 * @param card card dono do JLabel
 * @param image imagem do JLabel
 * @return JLabel configurado
 */
public static JLabel JLabelMaoDefault(Card card, ImageIcon image) {
    return new JLabel(image, JLabel.CENTER) {
        @Override
        public String toString() {
            return Values.TO_STRING_MAO + card.id_long;
        }
    };
}
 
開發者ID:limagiran,項目名稱:hearthstone,代碼行數:15,代碼來源:Util.java

示例11: View

protected View(Instance instance, Heap heap) {
    this(instance, heap, new JLabel(Bundle.BrowserUtils_Loading(), JLabel.CENTER) {
        public void addNotify() { setEnabled(false); }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:DetailsProvider.java

示例12: show

public void show(Component parent, Runnable runOnClose) {
    this.runOnClose = runOnClose;
    key2bookmark = new HashMap<Character, BookmarkInfo>(2 * 46, 0.5f);
    BookmarkManager lockedBookmarkManager = BookmarkManager.getLocked();
    try {
        // Open projects should have their bookmarks loaded before invocation of this method
        // so that it's possible to enumerate present keys properly
        for (ProjectBookmarks projectBookmarks : lockedBookmarkManager.activeProjectBookmarks()) {
            for (FileBookmarks fileBookmarks : projectBookmarks.getFileBookmarks()) {
                for (BookmarkInfo bookmark : fileBookmarks.getBookmarks()) {
                    String key = bookmark.getKey();
                    if (key != null && key.length() > 0) {
                        key2bookmark.put(key.charAt(0), bookmark);
                    }
                }
            }
        }
    } finally {
        lockedBookmarkManager.unlock();
    }
    
    JPanel cellPanel = new JPanel();
    if (key2bookmark.size() > 0) {
        cellPanel.setLayout(new GridLayout(4, 10, 2, 2));
        addCells(cellPanel, 10 * 4, '1', '9', '0', '0', 'A', 'Z');
    } else { // No bookmarks with keys
        cellPanel.setLayout(new GridLayout(2, 1, 2, 2));
        JLabel noKeysLabel = new JLabel(NbBundle.getMessage(BookmarkKeyChooser.class, "LBL_keyChooserNoActiveKeys"), JLabel.CENTER);
        JLabel noKeysHelpLabel = new JLabel(NbBundle.getMessage(BookmarkKeyChooser.class, "LBL_keyChooserNoActiveKeysHelp"), JLabel.CENTER);
        cellPanel.add(noKeysLabel);
        cellPanel.add(noKeysHelpLabel);
    }
    cellPanel.setBorder(new EmptyBorder(4, 4, 4, 4));
    closeButton = new JButton(NbBundle.getMessage(BookmarkKeyChooser.class, "CTL_keyChooserCloseButton")); // NOI18N

    dialog = org.netbeans.editor.DialogSupport.createDialog(
            NbBundle.getMessage(BookmarkKeyChooser.class, "CTL_keyChooserTitle"), // NOI18N
            cellPanel, true, // modal
            new JButton[] { closeButton }, false, // bottom buttons
            0, // defaultIndex = 0 => allow close by Enter key too
            0, // cancelIndex
            this // ActionListener
    );
    dialog.pack();
    
    Point parentMidPoint = new Point(parent.getWidth() / 2, parent.getHeight() / 2);
    SwingUtilities.convertPointToScreen(parentMidPoint, parent);
    dialog.setBounds(
            parentMidPoint.x - dialog.getWidth() / 2,
            parentMidPoint.y - dialog.getHeight() / 2,
            dialog.getWidth(),
            dialog.getHeight()
    );
    closeButton.addKeyListener(this);
    dialog.setAlwaysOnTop(true);
    dialog.setVisible(true);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:57,代碼來源:BookmarkKeyChooser.java

示例13: Quantidade

public Quantidade(Heroi heroi) {
    super("", JLabel.CENTER);
    this.heroi = heroi;
    init();
}
 
開發者ID:limagiran,項目名稱:hearthstone,代碼行數:5,代碼來源:Segredo.java

示例14: getHorizontalAlignment

@Override
public int getHorizontalAlignment() {
       return JLabel.CENTER;
   }
 
開發者ID:gamefest2017,項目名稱:ants,代碼行數:4,代碼來源:MenuQualificationTableCellRenderer.java

示例15: WeekLabel

public WeekLabel(int index, String name){
    super(name, JLabel.CENTER);
    this.name = name;
}
 
開發者ID:sivanWu0222,項目名稱:SimpleERP,代碼行數:4,代碼來源:Chooser.java


注:本文中的javax.swing.JLabel.CENTER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。