コード例 #1
0
  public ifAccountTool(ImageIcon head, String name, int usingsp, int totalsp) {
    super("AccountTool", false, false, false, false);
    setLayout(null);
    lp_layer = this.getLayeredPane();

    head = ImageProcess.scaleImage(head, 230, ImageProcess.Auto);
    head = ImageProcess.cutImage(head, 0, 0, 230, 230);

    ifAT_iclblHead = new JLabel(head);
    ifAT_iclblHead.setBorder(BorderFactory.createLineBorder(Color.BLUE));
    ifAT_iclblHead.setBounds(20, 20, 230, 230);
    ifAT_iclblHead.setBackground(Color.BLACK);
    getContentPane().add(ifAT_iclblHead);

    lblName_ftName = new Font("微軟正黑體", Font.BOLD, 20);
    ifAT_lblName = new JLabel(name, JLabel.CENTER);
    ifAT_lblName.setFont(lblName_ftName);
    ifAT_lblName.setBounds(20, 210, 230, 130);
    getContentPane().add(ifAT_lblName);

    ifAT_pbSpace = new JProgressBar();
    ifAT_pbSpace.setMaximum(totalsp);
    ifAT_pbSpace.setMinimum(0);
    ifAT_pbSpace.setValue(usingsp);
    ifAT_pbSpace.setBorderPainted(true);
    ifAT_pbSpace.setStringPainted(true);
    ifAT_pbSpace.setBounds(20, 300, 230, 20);
    getContentPane().add(ifAT_pbSpace);

    ifAT_toolbar = new ToolBar();
    ifAT_toolbar.AddTool("aEdit", null);
    ifAT_toolbar.AddTool("Plus", null);
    ifAT_toolbar.AddTool("Logout", null);
    lp_layer.setLayout(new BorderLayout());
    lp_layer.add(ifAT_toolbar, BorderLayout.SOUTH, new Integer(2550));

    setVisible(true);
    getContentPane().setBackground(Color.WHITE);
  }
コード例 #2
0
ファイル: TwoMedia.java プロジェクト: jedavis82/WebTOP
  protected void setupGUI() {
    controls = new Controls(this);

    sourcePanel = new SourcePanel(this, controls);

    JPanel myPanel = new JPanel();
    GridBagLayout layout = new GridBagLayout();
    myPanel.setLayout(layout);
    myPanel.add(
        controls,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    myPanel.add(
        sourcePanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    addToConsole(myPanel);

    // set up the toolbar
    ToolBar toolbar = getToolBar();
    toolbar.addBrowserButton("Directions", "/org/webtop/html/twomedia/directions.html");
    toolbar.addBrowserButton("Theory", "/org/webtop/html/twomedia/theory.html");
    toolbar.addBrowserButton("Examples", "/org/webtop/html/twomedia/examples.html");
    toolbar.addBrowserButton("Exercises", "/org/webtop/html/twomedia/exercises.html");
    toolbar.addBrowserButton("Images", "/org/webtop/html/twomedia/images.html");
    toolBar.addBrowserButton("About", "/org/webtop/html/license.html");
  }