下面列出了javax.swing.JLabel#setFont ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private JPanel createStackTracePanel(String stackTrace) {
final JTextArea textArea = new JTextArea();
textArea.setFont(textArea.getFont().deriveFont((float) textArea.getFont().getSize() - 1));
textArea.setEditable(false);
textArea.setCaretPosition(0);
// background nécessaire avec la plupart des look and feels dont Nimbus,
// sinon il reste blanc malgré editable false
textArea.setBackground(Color.decode("#E6E6E6"));
textArea.setText(stackTrace);
final JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
final JLabel label = new JLabel("Stack-trace");
label.setFont(label.getFont().deriveFont(Font.BOLD));
panel.add(label, BorderLayout.NORTH);
final JScrollPane scrollPane = new JScrollPane(textArea);
panel.add(scrollPane, BorderLayout.CENTER);
return panel;
}
private JPanel createSqlRequestExplainPlanPanel(String sqlRequestExplainPlan) {
final JTextArea textArea = new JTextArea();
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, textArea.getFont().getSize() - 1));
textArea.setEditable(false);
textArea.setCaretPosition(0);
// background nécessaire avec la plupart des look and feels dont Nimbus,
// sinon il reste blanc malgré editable false
textArea.setBackground(Color.decode("#E6E6E6"));
textArea.setText(sqlRequestExplainPlan);
final JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
final JLabel label = new JLabel(getString("Plan_d_execution"));
label.setFont(label.getFont().deriveFont(Font.BOLD));
panel.add(label, BorderLayout.NORTH);
final JScrollPane scrollPane = new JScrollPane(textArea);
panel.add(scrollPane, BorderLayout.CENTER);
return panel;
}
private void setUpValueSlider(FeedbackQuestion question) {
logger.info(
"Setting up value slider for IntRangeQuestionPanel. " + "@IntRangeQuestionPanel");
naValue = question.getIntRangeMin() - 1;
valueSlider.setMinimum(naValue);
valueSlider.setMaximum(question.getIntRangeMax());
Dictionary<Integer, JLabel> labelTable = new Hashtable<>();
JLabel naLabel = new JLabel("-");
naLabel.setFont(naLabel.getFont().deriveFont(Font.PLAIN));
labelTable.put(naValue, naLabel);
setFeedbackValues(labelTable, naLabel);
valueSlider.setLabelTable(labelTable);
valueSlider.setValue(naValue);
}
@Override
public Component getListCellRendererComponent(
final JList<? extends Tech> list, final Tech value, final int index,
final boolean isSelected, final boolean cellHasFocus) {
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(
list, value, index, isSelected, cellHasFocus);
renderer.setFont(GuiStatics.getFontCubellan());
renderer.setIcon(value.getIcon().getAsIcon());
if (isSelected) {
renderer.setForeground(GuiStatics.COLOR_GREEN_TEXT);
renderer.setBackground(Color.BLACK);
} else {
renderer.setForeground(GuiStatics.COLOR_GREEN_TEXT_DARK);
renderer.setBackground(Color.BLACK);
}
return renderer;
}
private void labelsFactory() {
minLabel = new JLabel("min");
minLabel.setBounds(15, 50, 150, 25);
minLabel.setFont(sansSerif_12_Plain);
minLabel.setHorizontalAlignment(LEFT);
heatMapDetailsPanel.add(minLabel);
maxLabel = new JLabel("max");
maxLabel.setBounds(getWidth() - 170, 50, 150, 25);
maxLabel.setFont(sansSerif_12_Plain);
maxLabel.setHorizontalAlignment(RIGHT);
heatMapDetailsPanel.add(maxLabel);
variableLabel = new JLabel("var");
variableLabel.setBounds(getWidth() / 2 - 110, 50, 220, 25);
variableLabel.setFont(sansSerif_12_Plain);
variableLabel.setHorizontalAlignment(CENTER);
heatMapDetailsPanel.add(variableLabel);
}
@Override
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
JLabel renderer = (JLabel) super.getTableCellRendererComponent(data);
Object value = data.getValue();
JTable table = data.getTable();
boolean isSelected = data.isSelected();
if (value == null) {
return renderer;
}
// this class is only meant to handle PreviewTableCellData objects
if (!(value instanceof PreviewTableCellData)) {
Msg.error(this,
"Renderer is not being used on " + PreviewTableCellData.class.getSimpleName());
return renderer;
}
PreviewTableCellData previewData = (PreviewTableCellData) value;
String preview = previewData.getDisplayString();
boolean isOffcut = previewData.isOffcut();
String tooltipText = previewData.getHTMLDisplayString();
Color foreground = getForeground(table, isSelected, isOffcut);
renderer.setText(preview);
renderer.setFont(getFixedWidthFont());
renderer.setForeground(foreground);
renderer.setToolTipText(tooltipText);
return renderer;
}
@Override
public void initView() {
boolean editable = !rawDataProcessed;
removeAll();
this.setBackground(new Color(255, 222, 173));
this.setOpaque(true);
massSpecSetup = rawDataFileHandler.getMassSpec();
JLabel titleLabel = new JLabel("This form will be used to review and confirm SHRIMP parameter settings and options.");
titleLabel.setHorizontalAlignment(SwingConstants.LEFT);
titleLabel.setFont(ReduxConstants.sansSerif_12_Bold);
titleLabel.setBounds(leftMargin, 150, parentDimension.width - 50, 25);
this.add(titleLabel);
// temp setting
fullPropagationRB = new JRadioButton("Full uncertainty propagation");
fullPropagationRB.setSelected(true);
initReferenceMaterialChooser();
initToolBar(editable);
monitorButton.setEnabled(false);
repropagateButton.setEnabled(false);
}
public Component getMeasurementSubCellRenderer(JTable table, BodyScaleFactors scaleFactors, boolean isSelected, boolean hasFocus, int row, int col, int i, int n) {
String name;
Font font = null;
boolean valid = true;
if(scaleFactors.useManualScale()) {
name = "MANUAL SCALES";
font = boldFont;
} else {
name = (scaleFactors.measurements[i]==-1) ? ScaleFactorsTableModel.unassignedMeasurement : scaleToolModel.getMeasurementName(scaleFactors.measurements[i]);
font = regularFont;
if(scaleFactors.measurements[i]!=-1 && scaleToolModel.getMeasurementValue(scaleFactors.measurements[i])==null) valid = false;
}
// Reset bg/fg colors before calling super.getTableCellRendererComponent()
setBackground(null);
setForeground(null);
JLabel label = (JLabel)super.getTableCellRendererComponent(table,name,isSelected,hasFocus,row,col);
intendedBorder = label.getBorder();
if(n==3) label.setBorder(interiorBorders[i]);
else label.setBorder(null);
label.setHorizontalAlignment(SwingConstants.LEADING);
label.setFont(font);
// Override bg/fg colors for invalid measurment (most likely it refers to markers which are not available in the model)
if(!valid) {
if(isSelected) label.setForeground(invalidColor);
else label.setBackground(invalidColor);
}
return label;
}
public GlobalAndValueSourceTreeCellPanel() {
this.setLayout(new BorderLayout());
nameLabel = new JLabel("");
nameLabel.setFont(TREE_FONT);
nameLabel.setHorizontalAlignment(SwingConstants.LEFT);
// nameLabel.setPreferredSize(new Dimension(CELL_WIDTH, CELL_HEIGTH));
this.add(nameLabel, BorderLayout.CENTER);
errorIconLabel = new JLabel("");
this.add(errorIconLabel, BorderLayout.EAST);
}
private void init() {
setUndecorated(true);
try {
if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
if (!Config.getInstance().isNoTransparency())
setOpacity(0.85f);
}
} catch (Exception e) {
Logger.log(e);
}
setIconImage(ImageResource.getImage("icon.png"));
setSize(getScaledInt(350), getScaledInt(200));
setLocationRelativeTo(null);
setResizable(false);
getContentPane().setLayout(null);
getContentPane().setBackground(ColorResource.getDarkestBgColor());
titlePanel = new TitlePanel(null, this);
titlePanel.setOpaque(false);
titlePanel.setBounds(0, 0, getScaledInt(350), getScaledInt(50));
closeBtn = new CustomButton();
closeBtn.setBounds(getScaledInt(320), getScaledInt(5), getScaledInt(24), getScaledInt(24));
closeBtn.setIcon(ImageResource.getIcon("title_close.png",20,20));
closeBtn.setBackground(ColorResource.getDarkestBgColor());
closeBtn.setBorderPainted(false);
closeBtn.setFocusPainted(false);
closeBtn.setName("CLOSE");
closeBtn.addActionListener(this);
minBtn = new CustomButton();
minBtn.setBounds(getScaledInt(296), getScaledInt(5), getScaledInt(24), getScaledInt(24));
minBtn.setIcon(ImageResource.getIcon("title_min.png",20,20));
minBtn.setBackground(ColorResource.getDarkestBgColor());
minBtn.setBorderPainted(false);
minBtn.setFocusPainted(false);
minBtn.setName("MIN");
minBtn.addActionListener(this);
titleLbl = new JLabel(StringResource.get("TITLE_CONVERT"));
titleLbl.setFont(FontResource.getBiggerFont());
titleLbl.setForeground(ColorResource.getSelectionColor());
titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(250), getScaledInt(30));
JLabel lineLbl = new JLabel();
lineLbl.setBackground(ColorResource.getSelectionColor());
lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 2);
lineLbl.setOpaque(true);
prg = new JProgressBar();
prg.setBounds(getScaledInt(20), getScaledInt(85), getScaledInt(350) - getScaledInt(40), getScaledInt(5));
statLbl = new JLabel();
statLbl.setForeground(Color.WHITE);
statLbl.setBounds(getScaledInt(20), getScaledInt(100), getScaledInt(350) - getScaledInt(40), getScaledInt(25));
titlePanel.add(titleLbl);
titlePanel.add(minBtn);
titlePanel.add(closeBtn);
add(lineLbl);
add(titlePanel);
add(prg);
add(statLbl);
panel = new JPanel(null);
panel.setBounds(0, getScaledInt(150), getScaledInt(350), getScaledInt(50));
panel.setBackground(Color.DARK_GRAY);
btnCN = new CustomButton(StringResource.get("MENU_PAUSE"));
btnCN.setBounds(0, 1, getScaledInt(350), getScaledInt(50));
btnCN.setName("CLOSE");
applyStyle(btnCN);
panel.add(btnCN);
add(panel);
}
private void setup() {
this.setLayout(new MigLayout("ins 05, gapx 5, align left, "));
setBackground(new Color(51, 51, 51));
setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
skillLabel = new JLabel("SKILL:");
rankLabel = new JLabel("RANK:");
xpLabel = new JLabel("XP:");
xpToLevelLabel = new JLabel("XP TO LEVEL:");
xpToLevelBar = new JProgressBar(0);
xpToLevelBar.setStringPainted(true);
skill = new JLabel("");
rank = new JLabel("");
xp = new JLabel("");
xpToLevel = new JLabel("");
skillLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, skillLabel.getFont().getSize()));
rankLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, rankLabel.getFont().getSize()));
xpLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpLabel.getFont().getSize()));
xpToLevelLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpToLevelLabel.getFont().getSize()));
skill.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, skillLabel.getFont().getSize()));
rank.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, rankLabel.getFont().getSize()));
xp.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpLabel.getFont().getSize()));
xpToLevel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpToLevelLabel.getFont().getSize()));
skillLabel.setForeground(Color.white);
rankLabel.setForeground(Color.white);
xpLabel.setForeground(Color.white);
xpToLevelLabel.setForeground(Color.white);
skill.setForeground(Color.white);
rank.setForeground(Color.white);
xp.setForeground(Color.white);
xpToLevel.setForeground(Color.white);
xpToLevelBar.setForeground(Color.green);
xpToLevelBar.setBackground(Color.red);
xpToLevelBar.setBorder(BorderFactory.createLineBorder(Color.black));
xpToLevelBar.setUI(new BasicProgressBarUI());
add(skillLabel, "cell 0 0,spanx ");
add(rankLabel, "cell 0 1,spanx ");
add(xpLabel, "cell 0 2, gap 0,spanx");
add(xpToLevelLabel, "cell 0 3, gap 0,spanx ");
add(skill, "cell 1 0,spanx, gap 45");
add(rank, "cell 1 1, spanx, gap 45");
add(xp, "cell 1 2,spanx, gap 25");
add(xpToLevel, "cell 1 3, spanx, gap 100");
add(xpToLevelBar, "cell 0 4,spanx, width 100% ");
}
private JLabel getBoldLabel(String text) {
final JLabel lbl = new JLabel(text);
lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
return lbl;
}
JHello() {
JLabel jlabel = new JLabel("Hello");
jlabel.setFont(new Font("Monospaced", Font.PLAIN, 144));
getContentPane().add(jlabel);
pack();
}
public SearchAlignment()
{
super();
this.setTitle("Search Alignment");
this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
this.setPreferredSize(new Dimension(700,140));
aml = AML.getInstance();
//The containing panel
dialogPanel = new JPanel();
cl = new CardLayout();
dialogPanel.setLayout(cl);
//The search panel
JLabel desc = new JLabel("Enter Search Term: (min 3 characters)");
Font font = desc.getFont();
boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
desc.setFont(boldFont);
JPanel labelPanel = new JPanel();
labelPanel.add(desc);
Alignment a = AML.getInstance().getAlignment();
int total = a.size();
mappings = new ArrayList<String>(total);
for(int i = 0; i < total; i++)
{
Mapping m = a.get(i);
String map = aml.getSource().getName(m.getSourceId());
map += " = ";
map += aml.getTarget().getName(m.getTargetId());
mappings.add(map);
}
searchField = new JTextArea(1,60);
searchField.setEditable(true);
KeyStroke keyStroke = KeyStroke.getKeyStroke("ENTER");
Object actionKey = searchField.getInputMap(
JComponent.WHEN_FOCUSED).get(keyStroke);
searchField.getActionMap().put(actionKey, wrapper);
AutoCompleteDecorator.decorate(searchField,mappings,false);
JPanel selectionPanel = new JPanel();
selectionPanel.add(searchField);
cancel = new JButton("Cancel");
cancel.setPreferredSize(new Dimension(70,28));
cancel.addActionListener(this);
find = new JButton("Find");
find.setPreferredSize(new Dimension(70,28));
find.addActionListener(this);
JPanel buttonPanel = new JPanel();
buttonPanel.add(cancel);
buttonPanel.add(find);
searchPanel = new JPanel();
searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.PAGE_AXIS));
searchPanel.add(labelPanel);
searchPanel.add(selectionPanel);
searchPanel.add(buttonPanel);
dialogPanel.add(searchPanel, "Search");
cl.show(dialogPanel, "Search");
this.add(dialogPanel);
this.pack();
GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
int left = g.getCenterPoint().x - (int)(this.getPreferredSize().width / 2);
this.setLocation(left, 0);
this.setVisible(true);
}
/**
* The constructor that will add the items to this panel.
*
* @param freeColClient The {@code FreeColClient} for the game.
*/
public AboutPanel(FreeColClient freeColClient) {
super(freeColClient, null, new MigLayout("wrap"));
// Header with image
JLabel apLogoLabel = new JLabel(new ImageIcon(ImageLibrary
.getUnscaledImage("image.flavor.Title")));
apLogoLabel.setBorder(
new CompoundBorder(new EmptyBorder(2,2,2,2),
new BevelBorder(BevelBorder.LOWERED)));
add(apLogoLabel, "center");
// Create available Font choices
Font fontBold = FontLibrary.createFont(FontLibrary.FontType.NORMAL,
FontLibrary.FontSize.TINY, Font.BOLD,
getImageLibrary().getScaleFactor());
Font fontNormal = FontLibrary.createFont(FontLibrary.FontType.NORMAL,
FontLibrary.FontSize.TINY, getImageLibrary().getScaleFactor());
// Version
JLabel apVersion = Utility.localizedLabel("aboutPanel.version");
apVersion.setFont(fontBold);
JLabel apRevision = new JLabel(FreeCol.getRevision());
apRevision.setFont(fontNormal);
add(apVersion, "newline 20");
add(apRevision, "newline");
// Official Site Link
JLabel apOfficialSite = Utility.localizedLabel("aboutPanel.officialSite");
apOfficialSite.setFont(fontBold);
add(apOfficialSite, "newline 10");
JButton apSiteURL = Utility.getLinkButton(SITE_URL, null, SITE_URL);
apSiteURL.addActionListener(this);
apSiteURL.setFont(fontNormal);
add(apSiteURL, "newline");
// SourceForge Project Site Link
JLabel apSFProject = Utility.localizedLabel("aboutPanel.sfProject");
apSFProject.setFont(fontBold);
add(apSFProject, "newline 10");
JButton apProjectURL = Utility.getLinkButton(PROJECT_URL, null, PROJECT_URL);
apProjectURL.addActionListener(this);
apProjectURL.setFont(fontNormal);
add(apProjectURL, "newline");
//GitHub Mirror
JLabel apGitHubButton = Utility.localizedLabel("aboutPanel.github");
apGitHubButton.setFont(fontBold);
add(apGitHubButton, "newline 10");
JButton apGitHubURL = Utility.getLinkButton(GITHUB_URL, null, GITHUB_URL);
apGitHubURL.addActionListener(this);
apGitHubURL.setFont(fontNormal);
add(apGitHubURL, "newline");
// Manual
JLabel apManual = Utility.localizedLabel("aboutPanel.manual");
apManual.setFont(fontBold);
add(apManual, "newline 10");
JButton apManualURL = Utility.getLinkButton(MANUAL_URL, null,
MANUAL_URL);
apManualURL.addActionListener(this);
add(apManualURL, "newline");
// License Disclaimer
JTextArea apLegal = Utility.localizedTextArea("aboutPanel.legalDisclaimer");
apLegal.setFont(fontNormal);
add(apLegal, "newline 20, width 300px");
// Copyright
JLabel apCopyright = Utility.localizedLabel("aboutPanel.copyright");
apCopyright.setFont(fontNormal);
add(apCopyright, "newline 10");
add(okButton, "newline 20, tag ok");
}
private void initGUI(String impExpTitle, String impExpMessage) {
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
fileName = new JLabel(impExpMessage);
fileName.setFont(fileName.getFont().deriveFont(Font.BOLD));
messageLabel = new JLabel(" ");
cancelButton = new JButton(Language.I18N.getString("common.button.cancel"));
featureLabel = new JLabel(Language.I18N.getString("common.status.dialog.featureCounter"));
appearanceLabel = new JLabel(Language.I18N.getString("common.status.dialog.appearanceCounter"));
textureLabel = new JLabel(Language.I18N.getString("common.status.dialog.textureCounter"));
featureCounterLabel = new JLabel("0", SwingConstants.TRAILING);
appearanceCounterLabel = new JLabel("0", SwingConstants.TRAILING);
textureCounterLabel = new JLabel("0", SwingConstants.TRAILING);
featureCounterLabel.setPreferredSize(new Dimension(100, featureLabel.getPreferredSize().height));
appearanceCounterLabel.setPreferredSize(new Dimension(100, appearanceLabel.getPreferredSize().height));
textureCounterLabel.setPreferredSize(new Dimension(100, textureLabel.getPreferredSize().height));
progressBar = new JProgressBar();
setLayout(new GridBagLayout());
{
main = new JPanel();
add(main, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,5,5,5,5));
main.setLayout(new GridBagLayout());
{
int gridY = 0;
main.add(fileName, GuiUtil.setConstraints(0,gridY++,0.0,0,GridBagConstraints.HORIZONTAL,5,5,5,5));
main.add(messageLabel, GuiUtil.setConstraints(0,gridY++,0.0,0,GridBagConstraints.HORIZONTAL,5,5,0,5));
main.add(progressBar, GuiUtil.setConstraints(0,gridY++,1.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
details = new JLabel("Details");
main.add(details, GuiUtil.setConstraints(0,gridY++,1.0,0.0,GridBagConstraints.HORIZONTAL,5,5,0,5));
row = new JPanel();
row.setBackground(new Color(255, 255, 255));
row.setBorder(BorderFactory.createEtchedBorder());
main.add(row, GuiUtil.setConstraints(0,gridY++,1.0,0.0,GridBagConstraints.BOTH,0,5,5,5));
row.setLayout(new GridBagLayout());
{
row.add(featureLabel, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.HORIZONTAL,5,5,1,5));
row.add(featureCounterLabel, GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,5,5,1,5));
row.add(appearanceLabel, GuiUtil.setConstraints(0,1,0.0,0.0,GridBagConstraints.HORIZONTAL,1,5,1,5));
row.add(appearanceCounterLabel, GuiUtil.setConstraints(1,1,1.0,0.0,GridBagConstraints.HORIZONTAL,1,5,1,5));
row.add(textureLabel, GuiUtil.setConstraints(0,2,0.0,0.0,GridBagConstraints.HORIZONTAL,1,5,5,5));
row.add(textureCounterLabel, GuiUtil.setConstraints(1,2,1.0,0.0,GridBagConstraints.HORIZONTAL,1,5,5,5));
if (showTileCounter) {
tileLabel = new JLabel(Language.I18N.getString("common.status.dialog.tileCounter"));
tileCounterLabel = new JLabel("n/a", SwingConstants.TRAILING);
tileCounterLabel.setPreferredSize(new Dimension(100, tileCounterLabel.getPreferredSize().height));
row.add(tileLabel, GuiUtil.setConstraints(0,3,0.0,0.0,GridBagConstraints.HORIZONTAL,1,5,5,5));
row.add(tileCounterLabel, GuiUtil.setConstraints(1,3,1.0,0.0,GridBagConstraints.HORIZONTAL,1,5,5,5));
}
}
}
add(cancelButton, GuiUtil.setConstraints(0,1,0.0,0.5,GridBagConstraints.NONE,5,5,5,5));
}
pack();
progressBar.setIndeterminate(true);
addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
eventDispatcher.removeEventHandler(ExportStatusDialog.this);
}
});
}
@CalledOnlyBy(AmidstThread.EDT)
private JLabel createTitleLabel() {
JLabel result = new JLabel("Please select a Minecraft profile:", SwingConstants.CENTER);
result.setFont(new Font("arial", Font.BOLD, 16));
return result;
}
/** Create the progress panel. */
void createProgressPanel() {
GroupLayout gl = new GroupLayout(progressPanel);
progressPanel.setLayout(gl);
currentActionLabel = new JLabel();
currentFileLabel = new JLabel();
currentFileProgressLabel = new JLabel();
totalFileProgressLabel = new JLabel();
currentAction = new JLabel();
currentFile = new JLabel();
currentFileProgress = new JLabel();
totalFileProgress = new JLabel();
fileProgress = new JProgressBar();
fileProgress.setFont(fontMedium);
fileProgress.setStringPainted(true);
totalProgress = new JProgressBar();
totalProgress.setFont(fontMedium);
totalProgress.setStringPainted(true);
currentActionLabel.setFont(fontLarge);
currentActionLabel.setForeground(Color.LIGHT_GRAY);
currentFileLabel.setFont(fontMedium);
currentFileLabel.setForeground(Color.LIGHT_GRAY);
currentFileProgressLabel.setFont(fontMedium);
currentFileProgressLabel.setForeground(Color.LIGHT_GRAY);
totalFileProgressLabel.setFont(fontMedium);
totalFileProgressLabel.setForeground(Color.LIGHT_GRAY);
currentAction.setFont(fontLarge);
currentFile.setFont(fontMedium);
currentFileProgress.setFont(fontMedium);
totalFileProgress.setFont(fontMedium);
currentAction.setForeground(Color.ORANGE);
currentFile.setForeground(Color.WHITE);
currentFileProgress.setForeground(Color.WHITE);
totalFileProgress.setForeground(Color.WHITE);
fileProgress.setForeground(backgroundColoring);
totalProgress.setForeground(backgroundColoring);
gl.setHorizontalGroup(
gl.createParallelGroup()
.addGroup(
gl.createSequentialGroup()
.addGroup(
gl.createParallelGroup()
.addComponent(currentActionLabel)
.addComponent(currentFileLabel)
.addComponent(currentFileProgressLabel)
.addComponent(totalFileProgressLabel)
)
.addGap(20)
.addGroup(
gl.createParallelGroup()
.addGroup(
gl.createSequentialGroup()
.addComponent(currentAction, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
.addComponent(cancel)
)
.addComponent(currentFile)
.addComponent(currentFileProgress)
.addComponent(totalFileProgress)
)
)
.addComponent(fileProgress)
.addComponent(totalProgress)
);
gl.setVerticalGroup(
gl.createSequentialGroup()
.addGroup(
gl.createParallelGroup(Alignment.BASELINE)
.addComponent(currentActionLabel)
.addComponent(currentAction)
.addComponent(cancel)
)
.addGroup(
gl.createParallelGroup(Alignment.BASELINE)
.addComponent(currentFileLabel)
.addComponent(currentFile)
)
.addGroup(
gl.createParallelGroup(Alignment.BASELINE)
.addComponent(currentFileProgressLabel)
.addComponent(currentFileProgress)
)
.addGap(5)
.addComponent(fileProgress)
.addGap(5)
.addGroup(
gl.createParallelGroup(Alignment.BASELINE)
.addComponent(totalFileProgressLabel)
.addComponent(totalFileProgress)
)
.addGap(5)
.addComponent(totalProgress)
);
}
JHello() {
JLabel jlabel = new JLabel("Hello");
jlabel.setFont(new Font("Monospaced", Font.PLAIN, 144));
getContentPane().add(jlabel);
pack();
}
/**
* Creates a label with a specific font and color.
*
* @param text the text for the label.
* @param font the font.
* @param color the color.
*
* @return The label.
*/
public static JLabel createJLabel(String text, Font font, Color color) {
JLabel result = new JLabel(text);
result.setFont(font);
result.setForeground(color);
return result;
}