Example usage for javax.swing JLabel setFont

List of usage examples for javax.swing JLabel setFont

Introduction

In this page you can find the example usage for javax.swing JLabel setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:net.sf.jabref.gui.mergeentries.MergeEntries.java

private JLabel boldFontLabel(String text) {
    JLabel label = new JLabel(text);
    Font font = label.getFont();/*from  ww w  . j a  va  2 s. c  o  m*/
    label.setFont(font.deriveFont(font.getStyle() | Font.BOLD));
    return label;
}

From source file:MemoryMonitor.java

public MemoryMonitor() {
    setLayout(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
    add(surf = new Surface());
    controls = new JPanel();
    controls.setPreferredSize(new Dimension(135, 80));
    Font font = new Font("serif", Font.PLAIN, 10);
    JLabel label = new JLabel("Sample Rate");
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(label);//from  w w  w  .j ava2  s. com
    tf = new JTextField("1000");
    tf.setPreferredSize(new Dimension(45, 20));
    controls.add(tf);
    controls.add(label = new JLabel("ms"));
    label.setFont(font);
    label.setForeground(Color.red);
    controls.add(dateStampCB);
    dateStampCB.setFont(font);
    addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            removeAll();
            if ((doControls = !doControls)) {
                surf.stop();
                add(controls);
            } else {
                try {
                    surf.sleepAmount = Long.parseLong(tf.getText().trim());
                } catch (Exception ex) {
                }
                surf.start();
                add(surf);
            }
            validate();
            repaint();
        }
    });
}

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartUIHelper.java

/***********************************************************************************************
 * Create the default Toolbar for a Chart.
 *
 * @param obsinstrument/*from   w  ww .j  a v  a 2 s. c om*/
 * @param chart
 * @param title
 * @param fontdata
 * @param colourforeground
 * @param colourbackground
 * @param debug
 *
 * @return JToolBar
 */

public static JToolBar createDefaultToolbar(final ObservatoryInstrumentInterface obsinstrument,
        final ChartUIComponentPlugin chart, final String title, final FontInterface fontdata,
        final ColourInterface colourforeground, final ColourInterface colourbackground, final boolean debug) {
    final JToolBar toolbar;

    if ((obsinstrument != null) && (chart != null)) {
        final List<Component> listComponentsToAdd;
        final JLabel labelName;

        listComponentsToAdd = new ArrayList<Component>(10);

        //-------------------------------------------------------------------------------------
        // Initialise the Label

        labelName = new JLabel(title, RegistryModelUtilities.getAtomIcon(obsinstrument.getHostAtom(),
                ObservatoryInterface.FILENAME_ICON_CHART_VIEWER), SwingConstants.LEFT) {
            static final long serialVersionUID = 7580736117336162922L;

            // Enable Antialiasing in Java 1.5
            protected void paintComponent(final Graphics graphics) {
                final Graphics2D graphics2D = (Graphics2D) graphics;

                // For antialiasing text
                graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
                super.paintComponent(graphics2D);
            }
        };

        labelName.setFont(
                fontdata.getFont().deriveFont(ReportTableHelper.SIZE_HEADER_FONT).deriveFont(Font.BOLD));
        labelName.setForeground(colourforeground.getColor());
        labelName.setIconTextGap(UIComponentPlugin.TOOLBAR_ICON_TEXT_GAP);

        listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR_BUTTON));
        listComponentsToAdd.add(labelName);
        listComponentsToAdd.add(new JToolBar.Separator(UIComponentPlugin.DIM_TOOLBAR_SEPARATOR));

        listComponentsToAdd.add(Box.createHorizontalGlue());

        UIComponentHelper.addToolbarPrintButtons(listComponentsToAdd, chart, chart.getChartPanel(), title,
                fontdata, colourforeground, colourbackground, debug);

        // Build the Toolbar using the Components, if any
        toolbar = UIComponentHelper.buildToolbar(listComponentsToAdd);
    } else {
        toolbar = new JToolBar();
    }

    toolbar.setFloatable(false);
    toolbar.setMinimumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE);
    toolbar.setPreferredSize(UIComponentPlugin.DIM_TOOLBAR_SIZE);
    toolbar.setMaximumSize(UIComponentPlugin.DIM_TOOLBAR_SIZE);
    toolbar.setBackground(colourbackground.getColor());
    NavigationUtilities.updateComponentTreeUI(toolbar);

    return (toolbar);
}

From source file:com.qspin.qtaste.ui.MainPanel.java

public void genUI() {
    try {/*from   ww w. java 2s. c o  m*/
        getContentPane().setLayout(new BorderLayout());
        // prepare the top panel that contains the following panes:
        //   - logo
        //   - ConfigInfopanel
        //   - Current Date/time
        JPanel topanel = new JPanel(new BorderLayout());
        JPanel center = new JPanel(new GridBagLayout());
        ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin");
        JLabel iconlabel = new JLabel(topLeftLogo);

        mHeaderPanel = new ConfigInfoPanel(this);
        mTestCasePanel = new TestCasePane(this);
        mTestCampaignPanel = new TestCampaignMainPanel(this);

        mHeaderPanel.init();

        GridBagLineAdder centeradder = new GridBagLineAdder(center);
        JLabel sep = new JLabel("  ");
        sep.setFont(ResourceManager.getInstance().getSmallFont());
        sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor()));
        centeradder.setWeight(1.0f, 0.0f);
        centeradder.add(mHeaderPanel);

        // prepare the right panels containg the main information:
        // the right pane is selected through the tabbed pane:
        //    - Test cases: management of test cases and test suites
        //    - Test campaign: management of test campaigns
        //    - Interactive: ability to invoke QTaste verbs one by one

        mRightPanels = new JPanel(new CardLayout());

        mRightPanels.add(mTestCasePanel, "Test Cases");
        mRightPanels.add(mTestCampaignPanel, "Test Campaign");

        final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel();
        mRightPanels.add(testInterractivePanel, "Interactive");

        mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM);
        mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT));

        TestCaseTree tct = new TestCaseTree(mTestCasePanel);
        JScrollPane sp2 = new JScrollPane(tct);
        mTreeTabsPanel.addTab("Test Cases", sp2);

        // add tree view for test campaign definition
        com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree(
                mTestCampaignPanel.getTreeTable());
        JScrollPane sp3 = new JScrollPane(mtct);
        mTreeTabsPanel.addTab("Test Campaign", sp3);

        genMenu(tct);

        // add another tab contain used for Interactive mode
        TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel);
        JScrollPane spInter = new JScrollPane(jInteractive);
        mTreeTabsPanel.addTab("Interactive", spInter);

        // init will do the link between the tree view and the pane
        testInterractivePanel.init();

        // Define the listener to display the pane depending on the selected tab
        mTreeTabsPanel.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex());
                CardLayout rcl = (CardLayout) mRightPanels.getLayout();
                rcl.show(mRightPanels, componentName);
            }
        });
        mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (e.getID() == TestCampaignMainPanel.RUN_ID) {
                    if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) {
                        // open the tab test cases
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                mTreeTabsPanel.setSelectedIndex(0);
                                mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX);
                            }
                        });

                        // update the buttons
                        mTestCasePanel.setExecutingTestCampaign(true,
                                ((TestCampaignMainPanel) e.getSource()).getExecutionThread());
                        mTestCasePanel.updateButtons(true);
                    } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) {
                        mTestCasePanel.setExecutingTestCampaign(false, null);
                        mTestCasePanel.updateButtons();
                    }
                }
            }
        });

        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels);
        splitPane.setDividerSize(4);
        GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
        int mainHorizontalSplitDividerLocation = guiConfiguration
                .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285);
        splitPane.setDividerLocation(mainHorizontalSplitDividerLocation);

        splitPane.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals("dividerLocation")) {
                    GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
                    if (evt.getSource() instanceof JSplitPane) {
                        JSplitPane splitPane = (JSplitPane) evt.getSource();
                        guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY,
                                splitPane.getDividerLocation());
                        try {
                            guiConfiguration.save();
                        } catch (ConfigurationException ex) {
                            logger.error("Error while saving GUI configuration: " + ex.getMessage());
                        }
                    }
                }
            }
        });

        topanel.add(iconlabel, BorderLayout.WEST);
        topanel.add(center);

        getContentPane().add(topanel, BorderLayout.NORTH);
        getContentPane().add(splitPane);
        this.pack();

        this.setExtendedState(Frame.MAXIMIZED_BOTH);
        if (mTestSuiteDir != null) {
            DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir);
            if (testSuite != null) {
                testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour);
                setTestSuite(testSuite.getName());
                mTestCasePanel.runTestSuite(testSuite, false);
            }
        }
        setVisible(true);
        //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT));

    } catch (Exception e) {
        logger.fatal(e);
        e.printStackTrace();
        TestEngine.shutdown();
        System.exit(1);
    }

}

From source file:ca.phon.app.session.editor.view.segmentation.SegmentationEditorView.java

private void init() {
    segmentWindowField = new JTextField();
    SegmentWindowDocument segDoc = new SegmentWindowDocument();
    segmentWindowField.setDocument(segDoc);
    segmentWindowField.setText(DEFAULT_SEGMENT_WINDOW + "");
    segDoc.addDocumentListener(new SegmentWindowListener());

    segmentLabel = new SegmentLabel();
    segmentLabel.setSegmentWindow(DEFAULT_SEGMENT_WINDOW);
    segmentLabel.setCurrentTime(0L);//  www . j a va 2s.com
    segmentLabel.lockSegmentStartTime(-1L);

    modeBox = new JComboBox(SegmentationMode.values());
    modeBox.setSelectedItem(SegmentationMode.INSERT_AFTER_CURRENT);

    JPanel topPanel = new JPanel();
    FormLayout topLayout = new FormLayout("right:pref, 3dlu, fill:default:grow, pref",
            "pref, pref, pref, pref");
    topPanel.setLayout(topLayout);
    CellConstraints cc = new CellConstraints();
    topPanel.add(new JLabel("Segment Window"), cc.xy(1, 1));
    topPanel.add(segmentWindowField, cc.xy(3, 1));
    topPanel.add(new JLabel("ms"), cc.xy(4, 1));

    JLabel infoLabel = new JLabel("Set to 0 for unlimited segment time");
    infoLabel.setFont(infoLabel.getFont().deriveFont(10.0f));

    topPanel.add(infoLabel, cc.xy(3, 2));
    topPanel.add(new JLabel("Current Window"), cc.xy(1, 3));
    topPanel.add(segmentLabel, cc.xy(3, 3));

    topPanel.add(new JLabel("Mode"), cc.xy(1, 4));
    topPanel.add(modeBox, cc.xyw(3, 4, 2));

    setLayout(new BorderLayout());
    add(topPanel, BorderLayout.NORTH);

    participantPanel = new JPanel();

    participantPanel.setBackground(Color.white);
    participantPanel.setOpaque(true);

    JScrollPane participantScroller = new JScrollPane(participantPanel);
    Dimension prefSize = participantScroller.getPreferredSize();
    prefSize.height = 150;
    participantScroller.setPreferredSize(prefSize);
    Dimension maxSize = participantScroller.getMaximumSize();
    maxSize.height = 200;
    participantScroller.setMaximumSize(maxSize);
    Dimension minSize = participantScroller.getMinimumSize();
    minSize.height = 100;
    participantScroller.setMinimumSize(minSize);
    participantScroller.setBorder(BorderFactory.createTitledBorder("Participants"));

    add(participantScroller, BorderLayout.CENTER);

    updateParticipantPanel();
    setupEditorActions();
}

From source file:org.pmedv.core.dialogs.AbstractNiceDialog.java

private JPanel createHeader(String title, String subTitle, ImageIcon icon) {

    int headerHeight = 50;

    FormLayout formLayout = new FormLayout("8dlu, 10dlu, fill:pref:grow, 7dlu, pref, 7dlu",
            "4dlu, 13dlu,max(" + (headerHeight - 17) + "dlu;default),default");

    // GradientPanel header = new GradientPanel(formLayout,Color.WHITE,Color.LIGHT_GRAY);

    Color blue = new Color(153, 204, 255);
    GradientPanel header = new GradientPanel(formLayout, Color.WHITE, blue);
    header.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    header.setBackground(Color.white);

    JLabel titleLabel = new JLabel(title);
    JLabel subTitleLabel = new JLabel(subTitle);
    JLabel iconLabel = (icon == null ? new JLabel() : new JLabel(icon));

    titleLabel.setForeground(Color.black);
    subTitleLabel.setForeground(Color.black);

    titleLabel.setFont(new Font("Arial", Font.BOLD, 15));
    subTitleLabel.setFont(new Font("Arial", Font.PLAIN, 12));

    CellConstraints cc = new CellConstraints();
    header.add(titleLabel, cc.xywh(2, 2, 2, 1));
    header.add(subTitleLabel, cc.xywh(2, 3, 2, 1));
    header.add(iconLabel, cc.xywh(5, 1, 1, 3, "right,center"));

    return (header);

}

From source file:com.funambol.json.admin.JsonConnectorConfigPanel.java

/**
 * Create the panel//  www.j a v  a2s. c o  m
 */
private void init() {

    JLabel title, serverLabel;
    JPanel seccPanel;
    JPanel behaviourOnErrorsPanel;

    title = new JLabel();
    seccPanel = new JPanel();
    behaviourOnErrorsPanel = new JPanel();

    serverLabel = new JLabel();
    serverValue = new JTextField();

    setLayout(null);

    title.setFont(titlePanelFont);
    title.setText("Funambol Json Connector");
    title.setBounds(new Rectangle(14, 5, 316, 28));
    title.setAlignmentX(SwingConstants.CENTER);
    title.setBorder(new TitledBorder(""));

    seccPanel.setLayout(null);
    seccPanel.setBorder(new TitledBorder("HTTP Server Configuration"));

    serverLabel.setText("Server:");
    seccPanel.add(serverLabel);
    serverLabel.setBounds(10, 20, 116, 15);
    seccPanel.add(serverValue);
    serverValue.setBounds(150, 20, 220, 19);
    serverValue.setFont(defaultFont);

    add(seccPanel);
    seccPanel.setBounds(10, 50, 380, 70);

    //the ssl option panel

    behaviourOnErrorsPanel.setBorder(new TitledBorder("Behaviour on errors"));
    behaviourOnErrorsPanel.setLayout(null);

    stopSyncOnFatalError.setText("Stop sync on fatal errors");
    stopSyncOnFatalError.setBounds(10, 25, 200, 15);

    behaviourOnErrorsPanel.add(stopSyncOnFatalError);

    add(behaviourOnErrorsPanel);
    behaviourOnErrorsPanel.setBounds(10, 130, 380, 60);

    confirmButton.setFont(defaultFont);
    confirmButton.setText("Save");
    add(confirmButton);
    confirmButton.setBounds(160, 200, 70, 25);

    confirmButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                JsonConnectorConfigPanel.this.actionPerformed(new ActionEvent(JsonConnectorConfigPanel.this,
                        ACTION_EVENT_UPDATE, event.getActionCommand()));
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    //
    // Setting font...
    //
    Component[] components = getComponents();
    for (int i = 0; (components != null) && (i < components.length); ++i) {
        components[i].setFont(defaultFont);
    }

    //
    // We add it as the last one so that the font won't be changed
    //
    add(title);
}

From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java

/**
 * Create a UI panel to show export progress
 *//*  www  . ja  v a  2  s . co  m*/
private void createStatusPane() {
    this.statusPanel = new JPanel();
    this.statusPanel.setBackground(Color.white);
    this.statusPanel.setLayout(new BorderLayout(5, 5));
    this.statusPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));

    JPanel content = new JPanel();
    content.setBackground(Color.white);
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    content.add(Box.createVerticalStrut(30));
    JLabel l = new JLabel("Status", SwingConstants.CENTER);
    l.setAlignmentX(CENTER_ALIGNMENT);
    l.setFont(JuxtaUserInterfaceStyle.LARGE_FONT);
    content.add(l);
    content.add(Box.createVerticalStrut(10));
    this.statusLabel = new JLabel("", SwingConstants.CENTER);
    this.statusLabel.setAlignmentX(CENTER_ALIGNMENT);
    this.setFont(JuxtaUserInterfaceStyle.NORMAL_FONT);
    content.add(this.statusLabel);
    this.statusPanel.add(content, BorderLayout.CENTER);

    JPanel p = new JPanel();
    p.setBackground(Color.white);
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(Box.createHorizontalGlue());
    this.workAnimation = new JLabel();
    this.workAnimation.setIcon(JuxtaUserInterfaceStyle.WORKING_ANIMATION);
    p.add(this.workAnimation);
    p.add(Box.createHorizontalGlue());
    this.statusPanel.add(p, BorderLayout.NORTH);
}

From source file:net.mumie.coursecreator.gui.ClassChooser.java

private void buildLayout() {
    //       Dimensions of the Dialog      
    int width = 10;
    int height = 160;
    int buttonWidth = 100;
    int buttonHeight = 30;

    // sets the Layout
    this.getContentPane().setLayout(new GridBagLayout());

    // the Button and Label Text
    String okButtonText = "Zuweisen";
    String cancelButtonText = "Cancel";
    headlineLabelText = "";

    // the Fonts/*from  w ww  . j a v  a2s .c  o m*/
    Font font = new Font("SansSerif", Font.PLAIN, 14);
    Font headlineLabelFont = new Font("SansSerif", Font.PLAIN, 12);
    Font textFieldFont = new Font("Monospaced", Font.PLAIN, 10);

    // GridBagContraints for rootPanel (s.b.):
    GridBagConstraints rootPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 0);

    // GridBagContraints for headlineLabel:
    GridBagConstraints headlineLabelStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0);

    // GridBagConstraints for textFieldPanel (s.b.):
    GridBagConstraints textFieldPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0,
            1);

    // GridBagConstraints for buttonPanel (s.b.):
    GridBagConstraints buttonPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 2);

    // GridBagConstraints for serverTextField:
    GridBagConstraints serverTextFieldStyle = createGridBagContrains(GridBagConstraints.WEST, 6, 6, 6, 6, 1, 0);

    // GridBagContraints for okButton (s.b.):
    GridBagConstraints okButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0);

    // GridBagContraints for cancelButton (s.b.):
    GridBagConstraints cancelButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 1, 0);

    // Creating rootPanel (contains all components)
    JPanel rootPanel = new JPanel(new GridBagLayout());
    rootPanel.setFont(font);

    // Creating headlineLabel:
    JLabel headlineLabel = new JLabel(headlineLabelText);
    headlineLabel.setFont(headlineLabelFont);

    // Creating textFieldPanel:
    JPanel textFieldPanel = new JPanel(new GridBagLayout());
    textFieldPanel.setFont(font);

    // Creating classTextField:
    classBox = new JComboBox(this.classList);
    classBox.setFont(textFieldFont);

    String classPath = this.controller.getMetaInfoField().getMetaInfos().getClassPath();
    String className = this.controller.getMetaInfoField().getMetaInfos().getClassName();

    if (setSelectedClass(classPath, className) == -1)
        headlineLabel.setForeground(Color.RED);
    else
        headlineLabel.setForeground(Color.BLACK);

    headlineLabel.setText(this.headlineLabelText);

    // Creating buttonPanel:
    JPanel buttonPanel = new JPanel(new GridBagLayout());
    buttonPanel.setFont(font);

    // okButton:
    JButton okButton = new JButton(okButtonText);
    okButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
    okButton.setActionCommand(CommandConstants.META_INFO_FIELD_OK);
    okButton.addActionListener(this.controller);

    // cancelButton:
    JButton cancelButton = new JButton(cancelButtonText);
    cancelButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
    cancelButton.setActionCommand(CommandConstants.META_INFO_FIELD_CANCEL);
    cancelButton.addActionListener(this.controller);

    // Composing the GUI:
    this.getContentPane().setLayout(new GridBagLayout());
    this.getContentPane().add(rootPanel, rootPanelStyle);
    rootPanel.add(headlineLabel, headlineLabelStyle);
    rootPanel.add(textFieldPanel, textFieldPanelStyle);
    textFieldPanel.add(classBox, serverTextFieldStyle);
    rootPanel.add(buttonPanel, buttonPanelStyle);
    buttonPanel.add(okButton, okButtonStyle);
    buttonPanel.add(cancelButton, cancelButtonStyle);

    this.addWindowListener(this.windowListener);

    int maxString = this.headlineLabelText.length();
    for (int i = 0; i < this.classList.size(); i++) {
        maxString = Math.max(((String) this.classList.get(i).toString()).length(), maxString);
    }

    width = Math.max(width, maxString * 8);
    this.setSize(width, height);
}

From source file:org.obiba.onyx.jade.instrument.gehealthcare.CardiosoftInstrumentRunner.java

/**
 * Create an information dialog that tells the user to wait while the data is being processed.
 *///from w  w w . j  a va2s  .c o m
private void showProcessingDialog() {

    JPanel messagePanel = new JPanel();
    messagePanel.setAlignmentX(Component.CENTER_ALIGNMENT);
    messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.Y_AXIS));

    JLabel message = new JLabel(ecgResourceBundle.getString("Message.ProcessingEcgMeasurement"));
    message.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));
    messagePanel.add(message);

    JLabel subMessage = new JLabel(ecgResourceBundle.getString("Message.ProcessingEcgMeasurementInstructions"));
    subMessage.setFont(new Font(Font.DIALOG, Font.PLAIN, 14));
    subMessage.setForeground(Color.RED);
    messagePanel.add(subMessage);

    JFrame window = new JFrame();
    window.add(messagePanel);
    window.pack();

    // Make sure dialog stays on top of all other application windows.
    window.setAlwaysOnTop(true);
    window.setLocationByPlatform(true);

    // Center dialog horizontally at the bottom of the screen.
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    window.setLocation((screenSize.width - window.getWidth()) / 2, screenSize.height - window.getHeight() - 70);

    window.setEnabled(false);
    window.setVisible(true);

}