Esempio n. 1
0
  @Override
  public Component prepareView() {
    tabPan = new WebTabbedPane();
    tabPan.setOpaque(false);
    tabPan.setTabPlacement(WebTabbedPane.TOP);

    tabPan.addTab("  Enter Hour Details   ", getForm());

    return tabPan;
  }
Esempio n. 2
0
 public static void init() {
   WebLookAndFeel.install();
   WebFrame baseFrame =
       new WebFrame("Almöhi - <Hier sollte der Host stehen, zudem eine Verbindung besteht>");
   WebTabbedPane tabbedPane = new WebTabbedPane(WebTabbedPane.TOP);
   WebTextArea textArea = new WebTextArea();
   textArea.setEditable(false);
   tabbedPane.addTab("Bla", new WebLabel("Führerhauptquartier"));
   tabbedPane.addTab("Bla2", new WebLabel("Blondi"));
   WebAsyncTree tree = new WebAsyncTree(new DataProvider());
   WebSplitPane vert = new WebSplitPane(JSplitPane.VERTICAL_SPLIT, tabbedPane, textArea);
   WebSplitPane hor = new WebSplitPane(JSplitPane.HORIZONTAL_SPLIT, tree, vert);
   baseFrame.add(hor);
   baseFrame.setVisible(true);
   baseFrame.setState(baseFrame.MAXIMIZED_BOTH);
   baseFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 }
Esempio n. 3
0
  public void initComponents() {
    // setting frame
    setTitle("Opcje");
    setResizable(false);

    setDefaultCloseOperation(WebFrame.DISPOSE_ON_CLOSE);
    setRound(10);
    setShadeWidth(0);
    ComponentMoveAdapter.install(this);
    setShowMinimizeButton(false);

    // creating tab pane
    tabGroupPane = new WebTabbedPane();
    tabGroupPane.setTabPlacement(WebTabbedPane.TOP);
    tabGroupPane.setTabbedPaneStyle(TabbedPaneStyle.standalone);
    tabGroupPane.setRound(10);
    tabGroupPane.setFocusable(false);

    // content border
    final TitledBorderPainter titledBorderPainter = new TitledBorderPainter();
    titledBorderPainter.setTitleOffset(10);
    titledBorderPainter.setRound(Math.max(0, 8));
    titledBorderPainter.setMargin(10);
    titledBorderPainter.setWidth(0);
    // this.setPainter(titledBorderPainter);

    // adding main options tab
    mainOptionsTab = new MainOptionsTab();
    mainOptionsTab.setPainter(titledBorderPainter);
    tabGroupPane.add(mainOptionsTab);

    // adding notification options tab
    notificationsOptionTab = new NotificationsOptionTab();
    notificationsOptionTab.setPainter(titledBorderPainter);
    tabGroupPane.add(notificationsOptionTab);

    add(tabGroupPane);

    // inside padding
    tabGroupPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    // -------------------------------FINAL-------------------------------//
    setBounds(new Rectangle(getPreferredSize()));

    // getting windows size
    Dimension scrnSize = Toolkit.getDefaultToolkit().getScreenSize();
    int width = (int) scrnSize.getWidth();
    int height = (int) scrnSize.getHeight();

    // getting taksbar size
    Rectangle winSize = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    int taskBarHeight = scrnSize.height - winSize.height;

    // setting ui location on screen
    int xLocation = (width - (int) getPreferredSize().getWidth()) / 2;
    int yLocation = (height - (int) getPreferredSize().getHeight() - taskBarHeight) / 2;
    setLocation(xLocation, yLocation);
  }
Esempio n. 4
0
  public static WebTabbedPane createExampleTabs(WebLookAndFeelDemo owner, WebProgressDialog load) {
    // All example groups
    load.setText("Loading groups list");
    List<ExampleGroup> exampleGroups = getExampleGroups();
    load.setMinimum(0);
    load.setMaximum(exampleGroups.size() + 1);
    load.setProgress(0);

    // Example tabs
    WebTabbedPane exampleTabs = new WebTabbedPane();
    exampleTabs.setTabbedPaneStyle(TabbedPaneStyle.attached);
    // exampleTabs.setTabLayoutPolicy ( WebTabbedPane.SCROLL_TAB_LAYOUT );

    // Progress component
    IconProgress ip = (IconProgress) load.getMiddleComponent();

    // Creating all examples
    int progress = 1;
    for (ExampleGroup group : exampleGroups) {
      // Updating progress state
      load.setText("Loading group: " + group.getGroupName());
      load.setProgress(progress);
      progress++;

      // Updating progress icons
      Icon gi = group.getGroupIcon();
      ip.addLoadedElement(gi);

      // Adding group view to new tab
      exampleTabs.addTab(group.getGroupName(), gi, createGroupView(owner, group));

      // Applying foreground settings
      exampleTabs.setSelectedForegroundAt(
          exampleTabs.getTabCount() - 1, group.getPreferredForeground());

      // Applying specific group settings to tab
      group.modifyExampleTab(exampleTabs.getTabCount() - 1, exampleTabs);
    }
    load.setProgress(progress);

    return exampleTabs;
  }
  public Component getPreview(WebLookAndFeelDemo owner) {
    WebTabbedPane tabbedPane1 = new WebTabbedPane();
    tabbedPane1.setPreferredSize(new Dimension(150, 100));
    tabbedPane1.setTabPlacement(WebTabbedPane.TOP);
    setupTabbedPane(tabbedPane1);

    WebTabbedPane tabbedPane2 = new WebTabbedPane();
    tabbedPane2.setPreferredSize(new Dimension(150, 100));
    tabbedPane2.setTabPlacement(WebTabbedPane.BOTTOM);
    setupTabbedPane(tabbedPane2);

    WebTabbedPane tabbedPane3 = new WebTabbedPane();
    tabbedPane3.setPreferredSize(new Dimension(150, 120));
    tabbedPane3.setTabPlacement(WebTabbedPane.LEFT);
    setupTabbedPane(tabbedPane3);

    WebTabbedPane tabbedPane4 = new WebTabbedPane();
    tabbedPane4.setPreferredSize(new Dimension(150, 120));
    tabbedPane4.setTabPlacement(WebTabbedPane.RIGHT);
    setupTabbedPane(tabbedPane4);

    return new GroupPanel(
        4,
        false,
        new GroupPanel(4, tabbedPane1, tabbedPane2),
        new GroupPanel(4, tabbedPane3, tabbedPane4));
  }
Esempio n. 6
0
  MainFrame(
      final View view,
      TableView<?, ?> userList,
      TableView<?, ?> threadList,
      Component content,
      Component searchPanel,
      Component statusBar) {
    mView = view;

    // general view + behaviour
    this.setTitle("Kontalk Java Client");
    this.setSize(mConf.getInt(Config.VIEW_FRAME_WIDTH), mConf.getInt(Config.VIEW_FRAME_HEIGHT));

    this.setIconImage(Utils.getImage("kontalk.png"));

    // closing behaviour
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            if (mConf.getBoolean(Config.MAIN_TRAY_CLOSE)
                && SystemTray.getSystemTray().getTrayIcons().length > 0)
              MainFrame.this.toggleState();
            else mView.callShutDown();
          }
        });

    // menu
    WebMenuBar menubar = new WebMenuBar();
    this.setJMenuBar(menubar);

    WebMenu konNetMenu = new WebMenu("KonNet");
    konNetMenu.setMnemonic(KeyEvent.VK_K);

    mConnectMenuItem = new WebMenuItem(Tr.tr("Connect"));
    mConnectMenuItem.setAccelerator(Hotkey.ALT_C);
    mConnectMenuItem.setToolTipText(Tr.tr("Connect to Server"));
    mConnectMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            mView.callConnect();
          }
        });
    konNetMenu.add(mConnectMenuItem);

    mDisconnectMenuItem = new WebMenuItem(Tr.tr("Disconnect"));
    mDisconnectMenuItem.setAccelerator(Hotkey.ALT_D);
    mDisconnectMenuItem.setToolTipText(Tr.tr("Disconnect from Server"));
    mDisconnectMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            mView.callDisconnect();
          }
        });
    konNetMenu.add(mDisconnectMenuItem);
    konNetMenu.addSeparator();

    WebMenuItem statusMenuItem = new WebMenuItem(Tr.tr("Set status"));
    statusMenuItem.setAccelerator(Hotkey.ALT_S);
    statusMenuItem.setToolTipText(Tr.tr("Set status text send to other user"));
    statusMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            WebDialog statusDialog = new StatusDialog();
            statusDialog.setVisible(true);
          }
        });
    konNetMenu.add(statusMenuItem);
    konNetMenu.addSeparator();

    WebMenuItem exitMenuItem = new WebMenuItem(Tr.tr("Exit"));
    exitMenuItem.setAccelerator(Hotkey.ALT_E);
    exitMenuItem.setToolTipText(Tr.tr("Exit application"));
    exitMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            mView.callShutDown();
          }
        });
    konNetMenu.add(exitMenuItem);

    menubar.add(konNetMenu);

    WebMenu optionsMenu = new WebMenu(Tr.tr("Options"));
    optionsMenu.setMnemonic(KeyEvent.VK_O);

    WebMenuItem conConfMenuItem = new WebMenuItem(Tr.tr("Preferences"));
    conConfMenuItem.setAccelerator(Hotkey.ALT_P);
    conConfMenuItem.setToolTipText(Tr.tr("Set application preferences"));
    conConfMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            mView.showConfig();
          }
        });
    optionsMenu.add(conConfMenuItem);

    menubar.add(optionsMenu);

    WebMenu helpMenu = new WebMenu(Tr.tr("Help"));
    helpMenu.setMnemonic(KeyEvent.VK_H);

    WebMenuItem aboutMenuItem = new WebMenuItem(Tr.tr("About"));
    aboutMenuItem.setToolTipText(Tr.tr("About Kontalk"));
    aboutMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            MainFrame.this.showAboutDialog();
          }
        });
    helpMenu.add(aboutMenuItem);

    menubar.add(helpMenu);

    // Layout...
    this.setLayout(new BorderLayout(5, 5));

    // ...left...
    WebPanel sidePanel = new WebPanel(false);
    sidePanel.add(searchPanel, BorderLayout.NORTH);
    mTabbedPane = new WebTabbedPane(WebTabbedPane.LEFT);
    WebButton newThreadButton = new WebButton(Tr.tr("New"));
    newThreadButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO new thread button
          }
        });
    // String threadOverlayText =
    //        Tr.t/r("No chats to display. You can create a new chat from your contacts");
    WebScrollPane threadPane = createTablePane(threadList, newThreadButton, "threadOverlayText");
    mTabbedPane.addTab("", threadPane);
    mTabbedPane.setTabComponentAt(Tab.THREADS.ordinal(), new WebVerticalLabel(Tr.tr("Chats")));

    WebButton newUserButton = new WebButton(Tr.tr("Add"));
    newUserButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            WebDialog addUserDialog = new AddUserDialog();
            addUserDialog.setVisible(true);
          }
        });
    // String userOverlayText = T/r.tr("No contacts to display. You have no friends ;(");
    WebScrollPane userPane = createTablePane(userList, newUserButton, "userOverlayText");
    mTabbedPane.addTab("", userPane);
    mTabbedPane.setTabComponentAt(Tab.USER.ordinal(), new WebVerticalLabel(Tr.tr("Contacts")));
    mTabbedPane.setPreferredSize(new Dimension(250, -1));
    mTabbedPane.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            mView.tabPaneChanged(Tab.values()[mTabbedPane.getSelectedIndex()]);
          }
        });

    sidePanel.add(mTabbedPane, BorderLayout.CENTER);
    this.add(sidePanel, BorderLayout.WEST);

    // ...right...
    this.add(content, BorderLayout.CENTER);

    // ...bottom
    this.add(statusBar, BorderLayout.SOUTH);
  }
Esempio n. 7
0
 void selectTab(Tab tab) {
   mTabbedPane.setSelectedIndex(tab.ordinal());
 }