Example usage for javax.swing JFrame getTitle

List of usage examples for javax.swing JFrame getTitle

Introduction

In this page you can find the example usage for javax.swing JFrame getTitle.

Prototype

public String getTitle() 

Source Link

Document

Gets the title of the frame.

Usage

From source file:hr.fer.zemris.vhdllab.platform.support.VhdllabLifecycleAdvisor.java

private void showUserCredentials() {
    ApplicationWindow window = getApplication().getActiveWindow();
    JFrame frame = window.getControl();
    String user = ApplicationContextHolder.getContext().getUserId();

    frame.setTitle(frame.getTitle() + ", " + user);
    window.getStatusBar().setMessage("Logged in as " + user);
}

From source file:com.diversityarrays.kdxplore.specgroup.SpecimenGroupEditor.java

public void setOwnerWindow(JFrame frame) {
    if (ownerFrame != null) {
        throw new IllegalStateException("Already have an ownerFrame");
    }// ww  w  .  jav  a  2s  .  co  m
    ownerFrame = frame;
    if (backgroundRunner instanceof DefaultBackgroundRunner) {
        DefaultBackgroundRunner dbr = (DefaultBackgroundRunner) backgroundRunner;
        ownerFrame.setGlassPane(dbr.getBlockingPane());
    }
    title = frame.getTitle();
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            setDividerLocation(0.3);
            searcher.addPropertyChangeListener(DatabaseSearcher.PROP_CLIENT_CHANGED, clientChangedListener);
        }

        @Override
        public void windowClosed(WindowEvent e) {
            searcher.removePropertyChangeListener(DatabaseSearcher.PROP_CLIENT_CHANGED, clientChangedListener);
        }
    });
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Changes the Window indicator to shoe that it is modified
 * @param comp the Dialog/Frame// ww  w.  ja va2 s.c om
 * @param isModified whether it is modified
 */
public static void setWindowModified(final Component comp, final boolean isModified) {
    if (comp != null) {
        if (comp instanceof JDialog) {
            //JDialog dlg = (JDialog)comp;
            //if (isMacOS_10_5_X)
            //{
            //    only works on JFrame
            //    dlg.getRootPane().putClientProperty("JComponent.windowModified", isModified ? Boolean.TRUE : Boolean.FALSE);
            //} else
            //{
            // dlg.setTitle(dlg.getTitle() + "*");
            //}

        } else if (comp instanceof JFrame) {
            JFrame dlg = (JFrame) comp;
            if (isMacOS_10_5_X) {
                dlg.getRootPane().putClientProperty("JComponent.windowModified",
                        isModified ? Boolean.TRUE : Boolean.FALSE);

            } else {
                String title;
                if (isModified) {
                    title = dlg.getTitle() + "*";
                } else {
                    title = dlg.getTitle();
                    if (title.endsWith("*")) {
                        title = StringUtils.chomp(title);
                    }
                }
                dlg.setTitle(title);
            }
        }
    }
}

From source file:org.eclipse.jubula.rc.swing.listener.RecordActions.java

/**
 * select item//  w w w .j av a  2 s.c o  m
 * @param window Component
 * @param id IComponentIdentifier
 * @param a Action
 */
protected void waitForWindow(Component window, IComponentIdentifier id, Action a) {
    String title = null;
    if (window instanceof JFrame) {
        JFrame jf = (JFrame) window;
        title = StringParsing.singleQuoteText(jf.getTitle());
    }
    if (window instanceof JDialog) {
        JDialog jd = (JDialog) window;
        title = StringParsing.singleQuoteText(jd.getTitle());
    }
    if (title != null && !(title.equals(StringConstants.EMPTY))) {
        String operator = Constants.REC_OPERATOR;
        String delay = new Integer(Constants.REC_WAIT_DELAY).toString();

        String timeout = null;
        long timestamp = AUTServer.getInstance().getObservTimestamp();

        if (timestamp == 0) {
            timeout = new Integer(Constants.REC_WAIT_TIMEOUT).toString();
        } else {
            long timeoutLong = (System.currentTimeMillis() - timestamp) + 10000;
            double timeoutDouble = (Math.ceil(timeoutLong / 5000.0)) * 5000.0;
            int timeoutInt = (int) timeoutDouble;
            timeout = new Integer(timeoutInt).toString();
        }

        java.util.List winValues = new LinkedList();
        winValues.add(title);
        winValues.add(operator);
        winValues.add(timeout);
        winValues.add(delay);
        createCAP(a, id, winValues);
    }
}

From source file:org.eclipse.wb.tests.designer.core.nls.SourceEclipseModernTest.java

public void test_parse() throws Exception {
    createAccessorAndProperties();//from  w w  w  . j  a  v a  2 s . co  m
    ContainerInfo frame = parseContainer("public class Test extends JFrame {", "  public Test() {",
            "    setTitle(Messages.frame_title);", "    setName(Messages.frame_name);", "  }", "}");
    NlsSupport support = NlsSupport.get(frame);
    // check that we have DirectSource
    ModernEclipseSource source;
    {
        AbstractSource[] sources = support.getSources();
        assertEquals(1, sources.length);
        source = (ModernEclipseSource) sources[0];
    }
    // check getBundleComment()
    assertEquals("Eclipse modern messages class", ReflectionUtils.invokeMethod(source, "getBundleComment()"));
    // check that "title" is correct
    frame.refresh();
    try {
        JFrame jFrame = (JFrame) frame.getObject();
        assertEquals("My JFrame", jFrame.getTitle());
        assertEquals("My name", jFrame.getName());
    } finally {
        frame.refresh_dispose();
    }
}