本文整理匯總了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);
}
示例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);
}
示例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();
}
示例4: BlinkingLabel
BlinkingLabel() {
super(getHumanKeyStrokeText(keyStroke), JLabel.CENTER);
setOpaque(false);
setBorder(Utility.TRIVIAL_LINE_BORDER);
addKeyListener(this);
addMouseListener(this);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
};
}
示例11: View
protected View(Instance instance, Heap heap) {
this(instance, heap, new JLabel(Bundle.BrowserUtils_Loading(), JLabel.CENTER) {
public void addNotify() { setEnabled(false); }
});
}
示例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);
}
示例13: Quantidade
public Quantidade(Heroi heroi) {
super("", JLabel.CENTER);
this.heroi = heroi;
init();
}
示例14: getHorizontalAlignment
@Override
public int getHorizontalAlignment() {
return JLabel.CENTER;
}
示例15: WeekLabel
public WeekLabel(int index, String name){
super(name, JLabel.CENTER);
this.name = name;
}