Package javax.swing

Examples of javax.swing.JDesktopPane$ComponentPosition


        super(messages.getString("tab.loading.title"));
        int y = 0;
        this.parent = parent;
        int width, height = 0;
       
        JDesktopPane panel = new JDesktopPane();
        Container content = getContentPane();
        content.add(panel);
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
       
        JLabel message = new JLabel(messages.getString("label.loading"));       
        message.setSize((int) message.getPreferredSize().getWidth(), 30);
        message.setLocation(0, 0);
        panel.add(message);
        width = (int) message.getSize().getWidth() + 10;
   
        JProgressBar bar = new JProgressBar();
        bar.setIndeterminate(true);
        bar.setSize((int) bar.getPreferredSize().getWidth(), (int) bar.getPreferredSize().getHeight());
        height = (int) (message.getSize().getHeight() + bar.getSize().getHeight()) + 40;
        bar.setLocation((width - (int) bar.getSize().getWidth()) / 2, 30);
        panel.add(bar);
       
        setSize(width, height);
    }
View Full Code Here


        menuBar.add(menu);
        setJMenuBar(menuBar);
       
        //Creacio del panell i de la graella
        Container content = getContentPane();
        panel = new JDesktopPane();
        content.add(panel, BorderLayout.CENTER);
       
        searchPane = new JPanel();
        Dimension searchPaneSize = Toolkit.getDefaultToolkit().getScreenSize();
        searchPaneSize.setSize(300, searchPaneSize.getHeight() - 100);
View Full Code Here

        return panel;
    }
   
    protected JDesktopPane getOffersPanel(ArrayList<Offer> offers, int width, ResourceBundle messages)
    {
        JDesktopPane panel = new JDesktopPane();
        checkGroup = new ArrayList<JCheckBox>();
        int numOffers = offers.size();
        int x = 10;
        int y = 20;
        int i = 0;
        for (i = 0; i < numOffers; i++)
        {
            JCheckBox offerLab = new JCheckBox(messages.getString("label.offer"));
            offerLab.setSize((int) offerLab.getPreferredSize().getWidth(), 30);
            offerLab.setLocation(x, y);
            offerLab.setBackground(Color.WHITE);
            offerLab.setActionCommand(offers.get(i).getId());
            checkGroup.add(offerLab);
            panel.add(offerLab);
            JLabel offerPrice = new JLabel(offers.get(i).getPrice());
            offerPrice.setSize((int) offerPrice.getPreferredSize().getWidth(), 30);
            offerPrice.setLocation((width - 310) / 3, y);
            panel.add(offerPrice);
            JLabel offerCond = new JLabel(offers.get(i).getCondition());
            offerCond.setSize((int) offerCond.getPreferredSize().getWidth(), 30);
            offerCond.setLocation(2 * (width - 310) / 3, y);
            panel.add(offerCond);
            y = y + 40;    
        }
        addCart = new JButton(messages.getString("button.cart"));
        addCart.setSize((int) addCart.getPreferredSize().getWidth(), 50);
        addCart.setLocation(width - 200,  y);
        addCart.addActionListener(this);
        panel.add(addCart);
       
        panel.setBorder(BorderFactory.createTitledBorder(messages.getString("offer.title")));
        panel.setSize(width - 35, y + 60);
        panel.setPreferredSize(panel.getSize());
        panel.setMinimumSize(panel.getSize());
        panel.setMaximumSize(panel.getSize());
        return panel;
    }
View Full Code Here

    frame1.setContentPane(new JLabel("Frame 1"));
    frame2.setContentPane(new JLabel("Frame 2"));
    frame3.setContentPane(new JLabel("Frame 3"));
    frame4.setContentPane(new JLabel("Frame 4"));
    frame5.setContentPane(new JLabel("Frame 5"));
    JDesktopPane desktop = new TabbingDesktopPane();
    desktop.add(frame1);
    desktop.add(frame2);
    desktop.add(frame3);
    desktop.add(frame4, LayoutConstraints.bottomOf(frame3));
        desktop.add(frame5, LayoutConstraints.tabAfter(frame4));
    JFrame frame = new JFrame("Dockingtest");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(frame.getToolkit().getScreenSize());
    frame.setContentPane(desktop);
    frame.setVisible(true);
View Full Code Here

        int tabIndex = tabbedPane.getTabIndex(frame);
        tabbedPane.removeTabAt(tabIndex);
        handleRemoveLastTab(tabbedPane);
      } else if (frame.getClientProperty(TABBED_PANE_PROPERTY) != null) {
        JTabbedPane tabbedPane = (JTabbedPane)frame.getClientProperty(TABBED_PANE_PROPERTY);
        JDesktopPane desktop = frame.getDesktopPane();
        DockLayout dockLayout = (DockLayout)desktop.getLayout();
        dockLayout.replaceLayoutComponent(frame, tabbedPane);
        super.closeFrame(frame);
        desktop.add(tabbedPane);
        tabbedPane.setVisible(false);
        tabbedPane.putClientProperty(INTERNAL_FRAME_PROPERTY, null);
        frame.putClientProperty(TABBED_PANE_PROPERTY, null);
      } else {
        super.closeFrame(frame);
View Full Code Here

    }

  public void iconifyFrame(JInternalFrame frame) {
      Component child = getChild(frame);
      if (child instanceof DockingTabbedPane) {
        JDesktopPane desktop = (JDesktopPane)child.getParent();
        DockingTabbedPane tabbedPane = (DockingTabbedPane)child;
        int tabIndex = tabbedPane.getTabIndex(frame);
        frame.putClientProperty(TABBED_PANE_PROPERTY, tabbedPane);
        tabbedPane.removeTabAt(tabIndex);
        handleRemoveLastTab(tabbedPane);
        JDesktopIcon icon = frame.getDesktopIcon();
        if (desktop != null) {
          desktop.add(icon);
        }
      } else if (frame.getClientProperty(TABBED_PANE_PROPERTY) != null) {
        DockingTabbedPane tabbedPane = (DockingTabbedPane)frame.getClientProperty(TABBED_PANE_PROPERTY);
            JDesktopPane desktop = frame.getDesktopPane();
        DockLayout layout = (DockLayout)desktop.getLayout();
            super.iconifyFrame(frame);
        layout.replaceLayoutComponent(frame, tabbedPane);
        desktop.remove(frame);
        desktop.add(tabbedPane);
        frame.setVisible(true);
        tabbedPane.setVisible(false);
        tabbedPane.putClientProperty(INTERNAL_FRAME_PROPERTY, null);
      } else {
        super.iconifyFrame(frame);
View Full Code Here

    }
   
    public void endDraggingFrame(JComponent frame) {
      if (tabIndex > -1) {
          drawBounds(frame);
          JDesktopPane desktop = getDesktopPane(frame);
          Component component = desktop.getComponentAt(dragBounds.x, dragBounds.y);
          if (component != frame && frame instanceof JInternalFrame) {
            removeFrame(frame);
            //component may have changed due to the call of removeFrame
            component = desktop.getComponentAt(dragBounds.x, dragBounds.y);
            addTab(component, tabIndex, (JInternalFrame)frame);
          }
        tabIndex = -1;
        if (frame instanceof JInternalFrame) {
          setSelected((JInternalFrame)frame);
View Full Code Here

   
    protected void handleAddTab(DockingTabbedPane tabbedPane) {
        if (tabbedPane.getClientProperty(INTERNAL_FRAME_PROPERTY) != null) {
          JInternalFrame internalFrame = (JInternalFrame)tabbedPane.getClientProperty(INTERNAL_FRAME_PROPERTY);
          internalFrame.putClientProperty(TABBED_PANE_PROPERTY, null);
          JDesktopPane desktop = (JDesktopPane)internalFrame.getParent();
          DockLayout dockLayout = (DockLayout)desktop.getLayout();
          dockLayout.replaceLayoutComponent(internalFrame, tabbedPane);
          desktop.remove(internalFrame);
          desktop.add(tabbedPane);
          tabbedPane.addTab(internalFrame);
          desktop.moveToFront(tabbedPane);
        }
      tabbedPane.setVisible(true);
    }
View Full Code Here

      tabbedPane.setVisible(true);
    }
   
    protected void handleRemoveLastTab(JTabbedPane tabbedPane) {
      if (tabbedPane.getTabCount() == 1) {
        JDesktopPane desktop = (JDesktopPane)getChild(tabbedPane).getParent();
        if (desktop == null) {
          return;
        }
        JInternalFrame frame = getInternalFrame(tabbedPane, 0);
        frame.putClientProperty(TABBED_PANE_PROPERTY, tabbedPane);
        tabbedPane.putClientProperty(INTERNAL_FRAME_PROPERTY, frame);
        tabbedPane.removeTabAt(0);
        DockLayout dockLayout = (DockLayout)desktop.getLayout();
        dockLayout.replaceLayoutComponent(tabbedPane, frame);
        desktop.remove(tabbedPane);
        desktop.add(frame);
        desktop.moveToFront(frame);
      }
    }
View Full Code Here

    Pane.add(getJDesktopPane(), BorderLayout.CENTER);
    return Pane;
  }
 
  private JDesktopPane getJDesktopPane() {
    JDesktopPane mainPane = new JDesktopPane();
    int x, y, w;
    for (int i = 0; i < 56; i++) {
      x = -3 + (i % 8) * 30;
      y = 19 + (i / 8) * 15;
      w = 30;
      if (i % 8 == 0) {
        x = 1;
        w = 26;
      }
      day[i] = new JLabel();
      mainPane.add(getLabel(day[i],x,y,w), null);
    }
    mainPane.setBackground(new Color(122,138,153));
    setLabel(day[1],"ma",0);
    setLabel(day[2],"ti",0);
    setLabel(day[3],"on",0);
    setLabel(day[4],"to",0);
    setLabel(day[5],"fr",0);
    setLabel(day[6],"l�",0);
    setLabel(day[7],"s�",0);
    mainPane.add(getMonth(), null);
    mainPane.add(getYear(), null);
    mainPane.add(getButton(0,0,"\u25B2",new SF(){public void func() {But(true, 1);}}), null);
    mainPane.add(getButton(0,9,"\u25BC",new SF(){public void func() {But(true, -1);}}), null);
    mainPane.add(getButton(197,0,"\u25B2",new SF(){public void func() {But(false, 1);}}), null);
    mainPane.add(getButton(197,9,"\u25BC",new SF(){public void func() {But(false, -1);}}), null);
    update();
    return mainPane;
  }
View Full Code Here

TOP

Related Classes of javax.swing.JDesktopPane$ComponentPosition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.