Example usage for javax.swing JToolBar setVisible

List of usage examples for javax.swing JToolBar setVisible

Introduction

In this page you can find the example usage for javax.swing JToolBar setVisible.

Prototype

@BeanProperty(hidden = true, visualUpdate = true)
public void setVisible(boolean aFlag) 

Source Link

Document

Makes the component visible or invisible.

Usage

From source file:edu.ku.brc.specify.BackupAndRestoreApp.java

public void loggedIn(final Window window, final String databaseNameArg, final String userNameArg) {
    log.debug("loggedIn - database[" + databaseNameArg + "] username[" + userNameArg + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    boolean firstTime = this.databaseName == null;

    this.databaseName = databaseNameArg;
    this.userName = userNameArg;

    // This is used to fill who edited the object
    FormHelper.setCurrentUserEditStr(userNameArg);

    AppPreferences.setConnectedToDB(true);

    restartApp(window, databaseName, userName, false, firstTime);

    doLayout();//ww w  . j  av  a2s  . co m

    JToolBar toolBar = (JToolBar) UIRegistry.get(UIRegistry.TOOLBAR);
    if (toolBar != null && toolBar.getComponentCount() < 2) {
        toolBar.setVisible(false);
    }
    statusField.setSectionText(0, userName);
}

From source file:edu.ku.brc.specify.Specify.java

/**
 * Creates the initial panels that will be shown at start up and sets up the Application Context
 * @param databaseNameArg the database name
 * @param userNameArg the user name//from w  w w  .jav  a2 s.  c o m
 */
protected void initStartUpPanels(final String databaseNameArg, final String userNameArg) {

    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                initStartUpPanels(databaseNameArg, userNameArg);
            }
        });
        return;
    }

    TaskMgr.getInstance().readRegistry(UIRegistry.isMobile());

    TaskMgr.initializePlugins();

    Taskable bkTask = TaskMgr.getTask("BackupTask");
    if (bkTask != null) {
        bkTask.setIconName("MySQL");
    }
    validate();

    add(mainPanel, BorderLayout.CENTER);
    doLayout();

    mainPanel.setBackground(Color.WHITE);

    JToolBar toolBar = (JToolBar) UIRegistry.get(UIRegistry.TOOLBAR);
    if (toolBar != null && toolBar.getComponentCount() < 2) {
        toolBar.setVisible(false);
    }

    //        AttachmentManagerIface attchMgr = AttachmentUtils.getAttachmentManager();
    //        attchMgr.addListener(new AttachmentMgrListener()
    //        {
    //            int max = 0;
    //            @Override
    //            public void filesLoading(final int numberOfFiles)
    //            {
    //                final String statusName = "ATTACH";
    //                SwingUtilities.invokeLater(new Runnable()
    //                {
    //                    @Override
    //                    public void run()
    //                    {
    //                        //System.out.println("N: "+numberOfFiles+" MX: "+max);
    //                        statusField.setIndeterminate(statusName, numberOfFiles > 0);
    //                        
    ////                        if (max == 0) 
    ////                        {
    ////                            statusField.setProgressRange(statusName, 0, 100);
    ////                            statusField.setValue(statusName, 0);
    ////                        }
    ////                        boolean hasFiles = numberOfFiles > 0;
    ////                        if (hasFiles) 
    ////                        {
    ////                            if (numberOfFiles > max) 
    ////                            {
    ////                                max = numberOfFiles;
    ////                            } 
    ////                            int num = (int)((double)(max - numberOfFiles) / (double)max) * 100;
    ////                            System.out.println("N: "+numberOfFiles+" MX: "+max+"  num: "+num);
    ////                            if (numberOfFiles == max && max == 1)
    ////                            {
    ////                                statusField.setIndeterminate(statusName, true);
    ////                                System.out.println("setIndeterminate true");
    ////
    ////                            } else
    ////                            {
    ////                                statusField.setIndeterminate(statusName, false);
    ////                                statusField.setValue(statusName, num);
    ////                                System.out.println("setIndeterminate falsw");
    ////                                //progress.setValue(num);
    ////                                //progress.setString(Integer.toString(num)+"%");
    ////                            }
    ////                            //progress.repaint();
    ////                        } else 
    ////                        {
    ////                            max = 0;
    ////                            statusField.setProgressDone(statusName);
    ////                        }
    //                    }
    //                });
    //            }
    //        });

}