本文整理汇总了Java中javax.swing.JLabel.setHorizontalAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.setHorizontalAlignment方法的具体用法?Java JLabel.setHorizontalAlignment怎么用?Java JLabel.setHorizontalAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.setHorizontalAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGUI
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* Initializes GUI.
*/
private void initGUI() {
ParserUtilty parser = null;
Path path = null;
try {
path = Paths.get(pathString);
parser = new ParserUtilty(path);
} catch (Exception e) {
System.out.println("Unable to parse given file! " + e.getMessage());
System.exit(-1);
}
BarChart model = new BarChart(parser.getValues(),
parser.getxDescription(), parser.getyDescription(),
parser.getyStart(), parser.getyEnd(), parser.getStep());
BarChartComponent komponenta = new BarChartComponent(model);
JLabel label = new JLabel(path.toAbsolutePath().toString());
label.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(label, BorderLayout.PAGE_START);
getContentPane().add(komponenta, BorderLayout.CENTER);
getContentPane().setBackground(Color.WHITE);
pack();
}
示例2: Date
import javax.swing.JLabel; //导入方法依赖的package包/类
public Date(Color textColor, Font font, Color backgroundColor, boolean setOpaque) {
this.setLayout(new BorderLayout());
this.setBackground(backgroundColor);
this.setOpaque(setOpaque);
locale = Locale.getDefault();
dateText = new JLabel();
dateText.setHorizontalAlignment(JLabel.CENTER);
dateText.setVerticalAlignment(JLabel.CENTER);
dateText.setForeground(textColor);
dateText.setFont(font);
this.add(dateText, BorderLayout.CENTER);
iniciar();
}
示例3: initialize
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("Library Book Loan System - My Books and Reservations");
frame.setResizable(false);
frame.setBounds(100, 100, 700, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel label = new JLabel("Library Book Loan System");
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
label.setBounds(10, 11, 674, 30);
frame.getContentPane().add(label);
JLabel lblBookReservations = new JLabel("My Books and Reservations");
lblBookReservations.setHorizontalAlignment(SwingConstants.CENTER);
lblBookReservations.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
lblBookReservations.setBounds(10, 42, 674, 22);
frame.getContentPane().add(lblBookReservations);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBackground(SystemColor.text);
tabbedPane.setBounds(10, 75, 674, 228);
frame.getContentPane().add(tabbedPane);
initializeCurrentBooks(tabbedPane);
initializeWaitlist(tabbedPane);
initializeHistory(tabbedPane);
frame.setVisible(true);
}
示例4: initGUI
import javax.swing.JLabel; //导入方法依赖的package包/类
private void initGUI() {
this.setIconImage(JMTImageLoader.loadImage(IMG_JWATICON).getImage());
this.setResizable(false);
this.setTitle("JWAT");
this.setSize(CommonConstants.MAX_GUI_WIDTH_JWAT_STARTSCREEN, CommonConstants.MAX_GUI_HEIGHT_JWAT_STARTSCREEN);
//Image image = new ImageIcon(imageURL).getImage();
//image = image.getScaledInstance(400, 315, Image.SCALE_SMOOTH);
JPanel eastPanel = new JPanel(new BorderLayout());
eastPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
JPanel buttonPanel = new JPanel(new GridLayout(buttonAction.length, 1, 2, 2));
eastPanel.add(buttonPanel, BorderLayout.CENTER);
for (AbstractAction element : buttonAction) {
buttonPanel.add(createButton(element));
}
JLabel imageLabel = new JLabel();
imageLabel.setBorder(BorderFactory.createEmptyBorder(BUTTONSIZE - 5, 1, 0, 0));
//imageLabel.setIcon(new ImageIcon(image));
imageLabel.setIcon(new ImageIcon(new ImageIcon(imageURL).getImage().getScaledInstance(400, 315, Image.SCALE_SMOOTH)));
imageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
imageLabel.setVerticalAlignment(SwingConstants.NORTH);
this.getContentPane().add(imageLabel, BorderLayout.CENTER);
this.getContentPane().add(eastPanel, BorderLayout.EAST);
}
示例5: clearReference
import javax.swing.JLabel; //导入方法依赖的package包/类
private void clearReference() {
m_infoPanel.removeAll();
JLabel label = new JLabel("No identifier selected");
GuiTricks.unboldLabel(label);
label.setHorizontalAlignment(JLabel.CENTER);
m_infoPanel.add(label);
redraw();
}
示例6: BasicMessageEditor
import javax.swing.JLabel; //导入方法依赖的package包/类
public BasicMessageEditor(String message)
{
JLabel messageLabel = new JLabel(message);
messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
setLayout(new GridLayout(1, 1));
add(messageLabel);
}
示例7: makePauseLabel
import javax.swing.JLabel; //导入方法依赖的package包/类
public void makePauseLabel()
{
pauseLabel = new JLabel("PAUSE");
pauseLabel.setForeground(GameConstants.PAUSE_FG_COLOR);
pauseLabel.setBounds(0, 0, getWidth(), 2*getHeight()/3);
pauseLabel.setHorizontalAlignment(SwingConstants.CENTER);
add(pauseLabel);
}
示例8: startBuildingContent
import javax.swing.JLabel; //导入方法依赖的package包/类
private JPanel startBuildingContent() {
JPanel panel = new JPanel( new BorderLayout() );
panel.setOpaque( false );
JLabel lbl = new JLabel(BundleSupport.getLabel( "LoadingProjects" ));
lbl.setHorizontalAlignment(JLabel.CENTER);
panel.add( lbl, BorderLayout.CENTER );
loadProjects();
return panel;
}
示例9: makeDifficultyLabel
import javax.swing.JLabel; //导入方法依赖的package包/类
private void makeDifficultyLabel()
{
difficultyLabel = new JLabel("Choose Difficulty: ");
difficultyLabel.setBounds(0, height/3, width/2, height/10);
difficultyLabel.setHorizontalAlignment(SwingConstants.RIGHT);
difficultyLabel.setForeground(GameConstants.TEXT_COLOR);
difficultyLabel.setFont(FileUtils.getFont(Font.BOLD, 40));
add(difficultyLabel);
}
示例10: initLabels
import javax.swing.JLabel; //导入方法依赖的package包/类
private void initLabels()
{
domanda = new JLabel();
domanda.setFont(fontDomanda);
domanda.setText(progetto.mostraDomandaAttuale());
domanda.setHorizontalAlignment(JLabel.CENTER);
seleziona = new JLabel("Seleziona domande precedenti:");
seleziona.setHorizontalAlignment(JLabel.CENTER);
}
示例11: addLoadingLabel
import javax.swing.JLabel; //导入方法依赖的package包/类
private void addLoadingLabel() {
editor.setLayout(new BorderLayout());
loadingLabel = new JLabel(NbBundle.getMessage(CloneableEditor.class, "LBL_EditorLoading")); // NOI18N
loadingLabel.setOpaque(true);
loadingLabel.setHorizontalAlignment(SwingConstants.CENTER);
loadingLabel.setBorder(new EmptyBorder(new Insets(11, 11, 11, 11)));
loadingLabel.setVisible(false);
editor.add(loadingLabel, BorderLayout.CENTER);
}
示例12: Time
import javax.swing.JLabel; //导入方法依赖的package包/类
public Time(Color textColor, Font font, Color backgroundColor, boolean setOpaque) {
this.setLayout(new BorderLayout());
this.setBackground(backgroundColor);
this.setOpaque(setOpaque);
timeText = new JLabel();
timeText.setForeground(textColor);
timeText.setFont(font);
timeText.setHorizontalAlignment(JLabel.CENTER);
this.add(timeText, BorderLayout.CENTER);
start();
}
示例13: initComponents
import javax.swing.JLabel; //导入方法依赖的package包/类
private void initComponents() {
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
JPanel butPane = new JPanel();
butPane.add(new JButton(close), BorderLayout.SOUTH);
cp.add(butPane, BorderLayout.SOUTH);
JTabbedPane jtp = new JTabbedPane();
JPanel general = new JPanel(new BorderLayout());
JLabel ghelp = new JLabel(generalHelp);
ghelp.setHorizontalAlignment(SwingConstants.CENTER);
ghelp.setVerticalAlignment(SwingConstants.CENTER);
JLabel icon = new JLabel(UIManager.getIcon("OptionPane.informationIcon"));
Box lbox = Box.createHorizontalBox();
lbox.add(Box.createHorizontalStrut(10));
lbox.add(icon);
lbox.add(Box.createHorizontalStrut(10));
general.add(ghelp, BorderLayout.CENTER);
general.add(lbox, BorderLayout.WEST);
general.add(Box.createHorizontalStrut(10), BorderLayout.EAST);
jtp.add("General", general);
JPanel evaluator = new JPanel(new BorderLayout());
HtmlPanel ehelp = new HtmlPanel(evalHelp);
evaluator.add(Box.createHorizontalStrut(10), BorderLayout.WEST);
evaluator.add(new JScrollPane(ehelp), BorderLayout.CENTER);
evaluator.add(Box.createHorizontalStrut(10), BorderLayout.EAST);
jtp.add("Evaluator", evaluator);
cp.add(jtp, BorderLayout.CENTER);
}
示例14: TestWizardPanel
import javax.swing.JLabel; //导入方法依赖的package包/类
public TestWizardPanel() {
counter++;
name = "Panel " + counter;
JLabel jl = new JLabel("<html><center>This is <b>" + name + "</b>.<br>Have a nice day!</center></html>");
jl.setHorizontalAlignment(SwingConstants.CENTER);
jl.setHorizontalTextPosition(SwingConstants.CENTER);
jl.setFont(new Font("Arial", Font.PLAIN, 16));
jl.setBorder(BorderFactory.createEtchedBorder());
setLayout(new BorderLayout());
add(jl, BorderLayout.CENTER);
}
示例15: stylizeInfoLabel
import javax.swing.JLabel; //导入方法依赖的package包/类
public void stylizeInfoLabel(JLabel l){
l.setHorizontalAlignment(SwingConstants.LEFT);
l.setForeground(UIManager.getColor("Button.disabledToolBarBorderBackground"));
l.setFont(font_16_bold);
}