Example usage for javax.swing JLayeredPane setVisible

List of usage examples for javax.swing JLayeredPane setVisible

Introduction

In this page you can find the example usage for javax.swing JLayeredPane 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:com.t3.client.ui.T3Frame.java

public T3Frame(JMenuBar menuBar) {
    // Set up the frame
    super(AppConstants.APP_NAME);

    this.menuBar = menuBar;

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(this);
    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    SwingUtil.centerOnScreen(this);
    setFocusTraversalPolicy(new T3FocusTraversalPolicy());

    try {//from   www.j  av  a 2  s  .c  o  m
        setIconImage(ImageUtil.getImage(MINILOGO_IMAGE));
    } catch (IOException ioe) {
        String msg = I18N.getText("msg.error.loadingIconImage");
        log.error(msg, ioe);
        System.err.println(msg);
    }
    // Notify duration
    initializeNotifyDuration();

    // Components
    glassPane = new GlassPane();
    assetPanel = createAssetPanel();
    connectionPanel = createConnectionPanel();
    toolbox = new Toolbox();
    initiativePanel = createInitiativePanel();

    zoneRendererList = new CopyOnWriteArrayList<ZoneRenderer>();
    pointerOverlay = new PointerOverlay();
    colorPicker = new ColorPicker(this);
    textureChooserPanel = new TextureChooserPanel(colorPicker.getPaintChooser(), assetPanel.getModel(),
            "imageExplorerTextureChooser");
    colorPicker.getPaintChooser().addPaintChooser(textureChooserPanel);

    String credits = "";
    String version = "";
    Image logo = null;
    try {
        credits = new String(FileUtil.loadResource(CREDITS_HTML), "UTF-8"); // 2nd param of type Charset is Java6+
        version = TabletopTool.getVersion();
        credits = credits.replace("%VERSION%", version);
        logo = ImageUtil.getImage(T3_LOGO_IMAGE);
    } catch (Exception ioe) {
        log.error(I18N.getText("msg.error.credits"), ioe);
        ioe.printStackTrace();
    }
    aboutDialog = new AboutDialog(this, logo, credits);
    aboutDialog.setSize(354, 400);

    statusPanel = new StatusPanel();
    statusPanel.addPanel(getCoordinateStatusBar());
    statusPanel.addPanel(getZoomStatusBar());
    statusPanel.addPanel(MemoryStatusBar.getInstance());
    // statusPanel.addPanel(progressBar);
    statusPanel.addPanel(connectionStatusPanel);
    statusPanel.addPanel(activityMonitor);
    statusPanel.addPanel(new SpacerStatusBar(25));

    zoneRendererPanel = new JPanel(new PositionalLayout(5));
    zoneRendererPanel.setBackground(Color.black);
    //      zoneRendererPanel.add(zoneMiniMapPanel, PositionalLayout.Position.SE);
    //      zoneRendererPanel.add(getChatTypingLabel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatTypingPanel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatActionLabel(), PositionalLayout.Position.SW);

    commandPanel = new CommandPanel();
    TabletopTool.getMessageList().addObserver(commandPanel);

    rendererBorderPanel = new JPanel(new GridLayout());
    rendererBorderPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray));
    rendererBorderPanel.add(zoneRendererPanel);

    // Put it all together
    setJMenuBar(menuBar);
    add(BorderLayout.NORTH, new ToolbarPanel(toolbox));
    add(BorderLayout.SOUTH, statusPanel);

    JLayeredPane glassPaneComposite = new JLayeredPane();
    glassPaneComposite.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 1;

    glassPaneComposite.add(glassPane, constraints);
    glassPaneComposite.add(dragImageGlassPane, constraints);

    setGlassPane(glassPane);
    //      setGlassPane(glassPaneComposite);

    glassPaneComposite.setVisible(true);

    if (!TabletopTool.MAC_OS_X)
        removeWindowsF10();
    else
        registerForMacOSXEvents();

    TabletopTool.getEventDispatcher().addListener(this, TabletopTool.ZoneEvent.Activated);

    restorePreferences();
    updateKeyStrokes();

    // This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!)
    configureDocking();

    new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this);
    chatTyperObserver = new ChatTyperObserver();
    chatTyperTimers = new ChatNotificationTimers();
    chatTyperTimers.addObserver(chatTyperObserver);
    chatTimer = getChatTimer();
    setChatTypingLabelColor(AppPreferences.getChatNotificationColor());
}

From source file:net.rptools.maptool.client.ui.MapToolFrame.java

public MapToolFrame(JMenuBar menuBar) {
    // Set up the frame
    super(AppConstants.APP_NAME);

    this.menuBar = menuBar;

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(this);
    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    SwingUtil.centerOnScreen(this);
    setFocusTraversalPolicy(new MapToolFocusTraversalPolicy());

    try {/* w ww  . j a v  a2s.c  o m*/
        setIconImage(ImageUtil.getImage(MINILOGO_IMAGE));
    } catch (IOException ioe) {
        String msg = I18N.getText("msg.error.loadingIconImage");
        log.error(msg, ioe);
        System.err.println(msg);
    }
    // Notify duration
    initializeNotifyDuration();

    // Components
    glassPane = new GlassPane();
    assetPanel = createAssetPanel();
    connectionPanel = createConnectionPanel();
    toolbox = new Toolbox();
    initiativePanel = createInitiativePanel();

    zoneRendererList = new CopyOnWriteArrayList<ZoneRenderer>();
    pointerOverlay = new PointerOverlay();
    colorPicker = new ColorPicker(this);
    textureChooserPanel = new TextureChooserPanel(colorPicker.getPaintChooser(), assetPanel.getModel(),
            "imageExplorerTextureChooser");
    colorPicker.getPaintChooser().addPaintChooser(textureChooserPanel);

    String credits = "";
    String version = "";
    Image logo = null;
    try {
        credits = new String(FileUtil.loadResource(CREDITS_HTML), "UTF-8"); // 2nd param of type Charset is Java6+
        version = MapTool.getVersion();
        credits = credits.replace("%VERSION%", version);
        logo = ImageUtil.getImage(MAPTOOL_LOGO_IMAGE);
    } catch (Exception ioe) {
        log.error(I18N.getText("msg.error.credits"), ioe);
        ioe.printStackTrace();
    }
    aboutDialog = new AboutDialog(this, logo, credits);
    aboutDialog.setSize(354, 400);

    statusPanel = new StatusPanel();
    statusPanel.addPanel(getCoordinateStatusBar());
    statusPanel.addPanel(getZoomStatusBar());
    statusPanel.addPanel(MemoryStatusBar.getInstance());
    // statusPanel.addPanel(progressBar);
    statusPanel.addPanel(connectionStatusPanel);
    statusPanel.addPanel(activityMonitor);
    statusPanel.addPanel(new SpacerStatusBar(25));

    zoneMiniMapPanel = new ZoneMiniMapPanel();
    zoneMiniMapPanel.setSize(100, 100);

    zoneRendererPanel = new JPanel(new PositionalLayout(5));
    zoneRendererPanel.setBackground(Color.black);
    //      zoneRendererPanel.add(zoneMiniMapPanel, PositionalLayout.Position.SE);
    //      zoneRendererPanel.add(getChatTypingLabel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatTypingPanel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatActionLabel(), PositionalLayout.Position.SW);

    commandPanel = new CommandPanel();
    MapTool.getMessageList().addObserver(commandPanel);

    rendererBorderPanel = new JPanel(new GridLayout());
    rendererBorderPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray));
    rendererBorderPanel.add(zoneRendererPanel);

    // Put it all together
    setJMenuBar(menuBar);
    add(BorderLayout.NORTH, new ToolbarPanel(toolbox));
    add(BorderLayout.SOUTH, statusPanel);

    JLayeredPane glassPaneComposite = new JLayeredPane();
    glassPaneComposite.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 1;

    glassPaneComposite.add(glassPane, constraints);
    glassPaneComposite.add(dragImageGlassPane, constraints);

    setGlassPane(glassPane);
    //      setGlassPane(glassPaneComposite);

    glassPaneComposite.setVisible(true);

    if (!MapTool.MAC_OS_X)
        removeWindowsF10();
    else
        registerForMacOSXEvents();

    MapTool.getEventDispatcher().addListener(this, MapTool.ZoneEvent.Activated);

    restorePreferences();
    updateKeyStrokes();

    // This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!)
    configureDocking();

    new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this);
    chatTyperObserver = new ChatTyperObserver();
    chatTyperTimers = new ChatNotificationTimers();
    chatTyperTimers.addObserver(chatTyperObserver);
    chatTimer = getChatTimer();
    setChatTypingLabelColor(AppPreferences.getChatNotificationColor());
}