Beispiel #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == btnBlue) {
     contentPane.setBackground(Color.BLUE);
   } else if (e.getSource() == btnYellow) {
     contentPane.setBackground(Color.YELLOW);
   } else if (e.getSource() == btnExit) {
     System.exit(0);
   }
 }
  UserInputValidationErrorBox(Frame parent, YWorkItem item, YDataStateException e) {
    super(parent, "Problem with your input data");
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    JPanel p = new JPanel(new BorderLayout());
    p.setBackground(YAdminGUI._apiColour);
    p.add(createTopPanel(item), BorderLayout.NORTH);
    p.add(createCentrePanel(e), BorderLayout.CENTER);
    c.add(p, BorderLayout.CENTER);
    c.add(createBottomPanel(), BorderLayout.SOUTH);
    c.setBackground(YAdminGUI._apiColour);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            storeData();
            this_windowClosing();
          }
        });

    Double screenWidth =
        new Double(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth());
    Double screenHeight =
        new Double(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight());
    setSize(new Double(screenWidth * 0.8).intValue(), new Double(screenHeight * 0.8).intValue());

    Dimension labelSize = this.getSize();
    setLocation(
        screenWidth.intValue() / 2 - (labelSize.width / 2),
        screenHeight.intValue() / 2 - (labelSize.height / 2));
    show();
  }
  private void setupUsernameRequestView() {
    PANEL = new JPanel();
    PANEL.setBackground(Color.BLACK);
    userName = new CstmTextField("", "Enter your name");
    enter = new CstmButton("ENTER");
    userNameLabel = new CstmLabel("USER NAME", SwingConstants.CENTER);
    serverTalkLabel = new CstmLabel("", SwingConstants.CENTER);
    PANEL.setLayout(new BoxLayout(PANEL, BoxLayout.Y_AXIS));
    userName.setPreferredSize(new Dimension(200, 30));
    userName.setAlignmentX(Component.CENTER_ALIGNMENT);
    enter.setPreferredSize(new Dimension(200, 30));
    enter.setAlignmentX(Component.CENTER_ALIGNMENT);
    serverTalkLabel.setPreferredSize(new Dimension(450, 30));
    serverTalkLabel.setAlignmentX(Component.CENTER_ALIGNMENT);

    enter.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            CHAT_CLIENT.chatNameRequest(userName.getText().trim());
          }
        });
    userNameLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
    PANEL.add(userNameLabel);
    PANEL.add(userName);
    PANEL.add(enter);
    PANEL.add(serverTalkLabel);
    Container container = getContentPane();
    container.setLayout(new GridBagLayout());
    container.add(PANEL, new GridBagConstraints());
    container.setBackground(Color.BLACK);
    pack();
    setVisible(true);
  }
Beispiel #4
0
  public ButtonGroupDemo() {
    super();

    // Hauptfenster einrichten
    setTitle("ButtonGroup-Demo");
    contentPane.setBackground(Color.LIGHT_GRAY);

    // Wechselschalter erzeugen und in Gruppe einf�gen
    // Der erste Schalter wird anfangs ausgew�hlt
    eins = new JToggleButton("Nummer 1", true);
    zwei = new JToggleButton("Nummer 2");
    drei = new JToggleButton("Nummer 3");
    gruppe.add(eins);
    gruppe.add(zwei);
    gruppe.add(drei);

    // Wechselschalter in Box einf�gen
    box.add(Box.createVerticalGlue());
    box.add(eins);
    box.add(zwei);
    box.add(drei);
    box.add(Box.createVerticalGlue());

    JPanel panel = new JPanel();
    panel.add(box);
    contentPane.add(panel);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Beispiel #5
0
  /**
   * ZombieFrame's constructor.
   *
   * @param contents Optional JPanel(s) to add to content pane. Arguments > 0 are ignored.
   */
  public ZombieFrame(JPanel... contents) {
    super("ZombieHouse");

    // Request keyboard focus for the frame.
    setFocusable(true);
    requestFocusInWindow();
    requestFocus();

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setUndecorated(true);
    setResizable(false);
    setBackground(Color.BLACK);

    // The content pane. An optional JPanel may be passed into the
    // constructor. It creates an empty pane with a black background if
    // one isn't provided.
    pane = getContentPane();
    pane.setBackground(Color.BLACK);
    pane.setFocusable(false);
    pane.setVisible(true);
    if (contents.length > 0) {
      pane.add(contents[0]);
    }

    keys = new ZombieKeyBinds((JComponent) pane);

    // Get the graphics device information.
    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphics = environment.getDefaultScreenDevice();

    pack();

    // Go full screen, if supported.
    if (graphics.isFullScreenSupported()) {
      try {
        graphics.setFullScreenWindow(this);
        // Having gone full screen, retrieve the display size.
        // size = Toolkit.getDefaultToolkit().getScreenSize();

        // This double-switching of setVisible is to fix a bug with
        // full-screen-exclusive mode on OS X. Versions 10.8 and later
        // don't send keyboard events properly without it.
        if (System.getProperty("os.name").contains("OS X")) {
          setVisible(false);
        }
      } catch (HeadlessException ex) {
        System.err.println(
            "Error: primary display not set or found. "
                + "Your experience of life may be suboptimal.");
        ex.printStackTrace();
      }
    } else {
      // If full-screen-exclusive mode isn't supported, switch to
      // maximized window mode.
      System.err.println("Full-screen-exclusive mode not supported.");
      setExtendedState(Frame.MAXIMIZED_BOTH);
    }
    setVisible(true);
  }
Beispiel #6
0
  public FS_Navi_Tab() {
    initComponents();
    this.setOpacity(0.7f);

    Color c = new Color(70, 70, 70);
    Container con = this.getContentPane();
    con.setBackground(c);
  }
  public hostelStatus() {
    setTitle("Hostel");
    connect();
    updateRecord();

    JFrame fr = new JFrame();
    Toolkit tkt = fr.getToolkit();
    Dimension frsize = tkt.getScreenSize();
    setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8);
    setLayout(null);

    cn = getContentPane();
    cn.setBackground(new Color(190, 180, 170));

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    tl = new JLabel("Current Hostels Status");
    tl.setFont(new Font("Engravers MT", 1, 25));
    tl.setForeground(new Color(247, 251, 249));

    p1 = new JPanel();
    p1.setBounds(0, 0, 600, 50);
    p1.add(tl);
    p1.setBackground(new Color(31, 88, 166));
    cn.add(p1);

    b1 = new JButton("LOAD");
    b1.setMnemonic('L');
    b1.addActionListener(new dispListener());
    b1.setBounds(230, 320, 120, 30);

    b2 = new JButton("EXIT");
    b2.setMnemonic('X');
    b2.addActionListener(new exitListener());
    b2.setBounds(350, 320, 100, 30);

    cn.add(b1);
    cn.add(b2);

    table = new JTable(data, col);
    table.setFont(new Font("Serif", Font.BOLD, 16));
    table.setBackground(new Color(250, 250, 250));
    table.setEnabled(false);

    JScrollPane jsp = new JScrollPane(table);
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(5, 100, 590, 200);
    cn.add(jsp);

    screensize = Toolkit.getDefaultToolkit().getScreenSize();

    setSize(600, 400);
    setVisible(true);
    setVisible(true);
    setResizable(true);
    connect();
  }
Beispiel #8
0
  public Graph() {
    super("График");
    Container c = getContentPane();
    c.setLayout(null);
    c.setBackground(Color.CYAN);

    JLabel imglabel = new JLabel(new ImageIcon("graph2.png"));
    imglabel.setBounds(new Rectangle(0, 0, 600, 600));
    c.add(imglabel);
  }
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
Beispiel #10
0
  /**
   * Cr�e une nouvelle instance de CreeTrans
   *
   * @param mf fenetre principale de l'application
   * @param zg Zone graphique
   * @param auto automate
   * @param be barre d'�tat
   */
  public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) {

    super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true);

    this.setResizable(false);

    this.gz = g;
    this.auto = auto;
    this.bar = be;
    this.mf = mf;

    be.displayInfo("Creating interaction");

    tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel1.setBackground(Color.lightGray);
    tfJPanel1.add(new JLabel("Type  : "));
    groupe = new CheckboxGroup();
    plus = new Checkbox("activator", groupe, true);
    tfJPanel1.add(plus);
    minus = new Checkbox("inhibitor", groupe, false);
    tfJPanel1.add(minus);

    tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel2.setBackground(Color.lightGray);
    tfJPanel2.add(new JLabel("Threshold  = "));
    tf = new JTextField(auto.nbrCharTransLabel);
    tf.setText("1");
    tfJPanel2.add(tf);

    btJPanel = new JPanel(new GridLayout(1, 2, 0, 0));
    btJPanel.setBackground(Color.lightGray);
    ok = new Button("Ok");
    ok.setBackground(Color.lightGray);
    ok.addActionListener(this);
    cancel = new Button("Cancel");
    cancel.setBackground(Color.lightGray);
    cancel.addActionListener(this);
    btJPanel.add(ok);
    btJPanel.add(cancel);

    content = this.getContentPane();
    content.setLayout(new BorderLayout());
    content.setBackground(Color.lightGray);
    content.add(tfJPanel1, BorderLayout.NORTH);
    content.add(tfJPanel2, BorderLayout.CENTER);
    content.add(btJPanel, BorderLayout.SOUTH);

    this.pack();
    this.setLocationRelativeTo(this.mf);

    tf.requestFocusInWindow();

    // rendre la fenetre visible
    setVisible(true);
  }
Beispiel #11
0
 /**
  * A simplified way to see a JPanel or other Container. Pops up a JFrame with specified Container
  * as the content pane.
  */
 public static JFrame openInJFrame(
     Container content, int width, int height, String title, Color bgColor) {
   JFrame frame = new JFrame(title);
   frame.setBackground(bgColor);
   content.setBackground(bgColor);
   frame.setSize(width, height);
   frame.setContentPane(content);
   frame.addWindowListener(new ExitListener());
   frame.setVisible(true);
   return (frame);
 }
Beispiel #12
0
  private Container createContainer() {

    Container field = window.getContentPane();
    BorderLayout borderlayout = new BorderLayout();
    field.setLayout(borderlayout);
    field.add(createInfoPanel(), BorderLayout.NORTH);
    field.add(createContentPanel(), BorderLayout.CENTER);
    field.add(createButtonPanel(), BorderLayout.SOUTH);
    field.setBackground(Color.white);

    return field;
  }
Beispiel #13
0
  public Poll() {
    super("Vote for Tami, Brian, or Liz");

    Container c = getContentPane();
    c.setBackground(Color.WHITE);

    PollDisplayPanel chart = new PollDisplayPanel("Tami", "Brian", "Liz");
    PollControlPanel controls = new PollControlPanel(chart);

    c.add(chart, BorderLayout.CENTER);
    c.add(controls, BorderLayout.SOUTH);
  }
  public Semaforo() {

    setTitle("Tela Exemplo");
    setBounds(200, 120, 700, 600);

    setLayout(null);
    Container cnt = getContentPane();

    // Color fundoPagina = new Color ( 0x15984117 );
    cnt.setBackground(Color.WHITE);

    // --[ Adicionando elementos: JLabel ]---------------------------------\\
    // Passo 1: criar o elemento
    JLabel l = new JLabel("FEEVALE - Prog Para Internet II");
    // Passo 2: estabelecer posição e tamanho (sómente se não for utilizado um gerenciador de
    // layout)
    l.setBounds(0, 0, 700, 55);
    // Passo 3: adicionar o elemento ao container.
    cnt.add(l);

    JLabel l2 = new JLabel("Semáforo");
    // Passo 2: estabelecer posição e tamanho (sómente se não for utilizado um gerenciador de
    // layout)
    l2.setBounds(0, 55, 700, 20);
    // Passo 3: adicionar o elemento ao container.
    cnt.add(l2);

    // --[ Alterando cores e fontes ]--------------------------------------\\
    // Color cor = new Color( 0x1677721 );			Cor da letra.
    Color corFundo = new Color(0x6323595); // Cor da caixa ao redor das palavras.
    Color corFundo2 = new Color(0x15527921);

    l.setForeground(Color.WHITE);
    l.setBackground(corFundo);
    l.setOpaque(true);
    l.setHorizontalAlignment(JLabel.CENTER);

    l2.setForeground(Color.WHITE);
    l2.setBackground(corFundo);
    l2.setOpaque(true);
    l2.setHorizontalAlignment(JLabel.CENTER);

    Font fonte = new Font("Tahoma", Font.PLAIN, 20);

    l.setFont(fonte);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setVisible(true);
    criaGauge();
    criaExibicaoImagens();
  }
Beispiel #15
0
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }
    // Method to build the dialog box for help.
    private void buildDialogBox() {
      // Set the JDialog window properties.
      setTitle("Learning about Java");
      setResizable(false);
      setSize(dialogWidth, dialogHeight);

      // Define behaviors of container.
      c.setLayout(null);
      c.setBackground(Color.cyan);
      c.add(image);
      c.add(okButton);

      // Set the bounds for the image.
      image.setBounds(
          (dialogWidth / 2) - (imageWidth / 2),
          (top + (offsetMargin / 2)),
          imageWidth,
          imageHeight);

      // Set the behaviors, bounds and action listener for the button.
      okButton.setBounds(
          (dialogWidth / 2) - (buttonWidth / 2),
          (imageHeight + (int) 1.5 * offsetMargin),
          buttonWidth,
          buttonHeight);

      // Set the font to the platform default Font for the object with the
      // properties of bold and font size of 11.
      okButton.setFont(new Font(okButton.getFont().getName(), Font.BOLD, 11));

      // Set foreground and background of JButton(s).
      okButton.setForeground(Color.white);
      okButton.setBackground(Color.blue);

      // The class implements the ActionListener interface and therefore
      // provides an implementation of the actionPerformed() method.  When a
      // class implements ActionListener, the instance handler returns an
      // ActionListener.  The ActionListener then performs actionPerformed()
      // method on an ActionEvent.
      okButton.addActionListener(this);

      // Set the screen and display dialog window in relation to screen size.
      dim = tk.getScreenSize();
      setLocation((dim.width / 2) - (dialogWidth / 2), (dim.height / 2) - (dialogHeight / 2));

      // Display the dialog.
      show();
    } // End of buildDialogBox method.
Beispiel #17
0
  private void initComponents() {
    Container container = getContentPane();
    container.setBackground(bgColor);
    container.setLayout(new BorderLayout(0, 0));

    //
    // Left-side Intel image
    //
    JPanel leftBanner =
        new ImagePanel(UIImages.ABOUT_DIALOG_LEFT_BANNER_IMG.getImage(), Style.FIT_IMAGE_WIDTH);
    leftBanner.setOpaque(false);
    container.add(leftBanner, BorderLayout.WEST);

    JPanel rightMainPanel = getRightMainPanel();
    container.add(rightMainPanel, BorderLayout.CENTER);
  }
Beispiel #18
0
  /** 构造游戏大厅 */
  public GameHall() {
    hc = new HallClient();
    hpp = new HallPlayerPanel();
    room = new Room(hc);
    hc.getRoom(room);
    hnp = new HallNamePanel(hc);
    hc.getHallNamePanel(hnp);
    hcc = new HallChatClient(this);
    new Thread(hc).start();

    jsp =
        new JScrollPane(
            room,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(0, 0, 750, 590);
    jsp.setBorder(new LineBorder(new Color(81, 113, 158)));

    this.setTitle("游戏大厅");
    this.setSize(960, 620);
    this.setLocation(width / 2 - 480, height / 2 - 310);
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    this.setLayout(null);
    this.setResizable(false);
    Container con = this.getContentPane();
    con.setBackground(new Color(81, 113, 158));

    this.add(jsp);
    this.add(hcc);
    this.add(hnp);
    this.add(hpp);

    this.setVisible(true);

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            try {
              hc.dos.writeUTF("exit");
              hcc.dos.writeUTF(HallPlayerPanel.nickname + "退出了!");
            } catch (IOException e1) {
              e1.printStackTrace();
            }
          }
        });
  }
  public TotalBillsJFrame(double total) {

    setTitle("BILL");
    setSize(500, 400);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    Container container = getContentPane();
    setLayout((new BoxLayout(container, BoxLayout.Y_AXIS)));
    container.setBackground(Color.PINK);

    label = new JLabel();
    add(label);

    label.setText("The total of your bills is $" + total);
    label.setFont(new Font("Serif", Font.CENTER_BASELINE, 35));
    label.setAlignmentX(Component.CENTER_ALIGNMENT);
    label.setForeground(Color.GRAY);
  }
 public void setVisible(boolean visible) {
   if (!visible && myView != null) {
     disposeAndUpdate(false);
   } else if (visible && myView == null) {
     Window owner = UIUtil.getWindow(myOwner);
     if (owner != null) {
       if (myHeavyWeight) {
         Window view = pop(owner);
         if (view == null) {
           view = new JWindow(owner);
           setPopupType(view);
         }
         setAlwaysOnTop(view, myAlwaysOnTop);
         setWindowFocusable(view, myWindowFocusable);
         setWindowShadow(view, myWindowShadow);
         myView = view;
       } else if (owner instanceof RootPaneContainer) {
         JLayeredPane parent = ((RootPaneContainer) owner).getLayeredPane();
         if (parent != null) {
           JPanel view = new JPanel(new BorderLayout());
           view.setVisible(false);
           parent.add(view, JLayeredPane.POPUP_LAYER, 0);
           myView = view;
         }
       }
     }
     if (myView != null) {
       myView.add(myContent);
       Component parent = myView instanceof Window ? null : myView.getParent();
       if (parent != null) {
         Point location = myViewBounds.getLocation();
         SwingUtilities.convertPointFromScreen(location, parent);
         myViewBounds.setLocation(location);
       }
       myView.setBackground(UIUtil.getLabelBackground());
       myView.setBounds(myViewBounds);
       myView.setVisible(true);
       myViewBounds = null;
     }
   }
 }
Beispiel #21
0
  public MapViewer(String title) {
    super(title);
    setSize(800, 600);
    // setExtendedState(Frame.MAXIMIZED_BOTH);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    edgeCnt = 0;
    startMap();
    Container cp = getContentPane();
    cp.setLayout(new BorderLayout());
    cp.setBackground(Color.lightGray);
    // vv.getModel().getRelaxer().setSleepTime(500);
    vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>());

    vv.getRenderer()
        .getVertexLabelRenderer()
        .setPosition(edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position.CNTR);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
    vv.setForeground(Color.white);
    cp.add(vv, BorderLayout.CENTER);
    getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));
    setVisible(true);
    JMenuBar jb = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    jb.add(fileMenu);
    JMenuItem exitMenu = new JMenuItem("Exit");
    fileMenu.add(exitMenu);
    exitMenu.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            MapViewer.this.dispose();
          }
        });
    JMenu helpMenu = new JMenu("Help");
    jb.add(helpMenu);
    JMenuItem aboutItem = new JMenuItem("About");
    helpMenu.add(aboutItem);
    aboutItem.addActionListener(new AboutActionListener());
    this.setJMenuBar(jb);
    setLocationRelativeTo(null);
  }
Beispiel #22
0
  public ThreeDTest() {
    super("Using JPanels with Borders");
    setBounds(100, 300, 700, 500);

    addWindowListener(new ExitListener());

    Container content = getContentPane();
    content.setBackground(Color.lightGray);
    JPanel infoRegion = new JPanel(new GridLayout(3, 1));
    infoRegion.setPreferredSize(new Dimension(100, 500));
    content.add(infoRegion, BorderLayout.EAST);

    infoLabel = new Label();

    infoRegion.add(infoLabel);

    drag = new LocationPicker();
    content.add(drag, BorderLayout.WEST);

    pack();
    setVisible(true);
  }
 SpecificationQueryProcessingValidationErrorBox(
     Frame parent, YWorkItem item, YDataStateException message) {
   super(parent, "Runtime Problem with Process Specification detected");
   Container c = getContentPane();
   c.setLayout(new BorderLayout());
   JPanel p = new JPanel(new BorderLayout());
   p.setBackground(YAdminGUI._apiColour);
   p.add(createCentrePanel(message), BorderLayout.CENTER);
   c.add(p, BorderLayout.CENTER);
   c.add(createBottomPanel(), BorderLayout.SOUTH);
   c.setBackground(YAdminGUI._apiColour);
   addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           storeData();
           this_windowClosing();
         }
       });
   // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
   setSize(800, 600);
   Double screenWidth =
       new Double(
           GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth());
   Double screenHeight =
       new Double(
           GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight());
   //        setSize(new Double((screenWidth - guiSize.width) * 2).intValue(), new
   // Double((screenHeight - guiSize.height) * 2).intValue());
   //        setLocation(((screenWidth.intValue() - guiSize.width) / 2),0);
   //        pack();
   Dimension labelSize = this.getSize();
   setLocation(
       screenWidth.intValue() / 2 - (labelSize.width / 2),
       screenHeight.intValue() / 2 - (labelSize.height / 2));
   show();
 }
Beispiel #24
0
  private void createFrame(final String title) {

    buildTextPane3270();
    final JScrollPane tableScroller = buildFieldsTablePanel();

    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Terminal", null, textPane3270, "");
    tabbedPane.addTab("Fields", null, tableScroller, "");
    updateTabbedPaneSize();

    final JPanel debugPanel = buildDebugPanel(monospacedFont, sansFont);

    frame = new JFrame(title);

    final Container contentPane = frame.getContentPane();
    contentPane.setBackground(new Color(224, 224, 224));
    contentPane.add(tabbedPane, BorderLayout.NORTH);
    contentPane.add(debugPanel, BorderLayout.CENTER);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setResizable(false);
    frame.pack();
    frame.setVisible(true);
  }
  public HistogramGUI() {
    Container cp = getContentPane();
    cp.setBackground(Color.red);
    cp.setLayout(new FlowLayout());

    lblTitle = new JLabel("HistoGram Client");
    btnRun = new JButton("   Run!   ");
    txtWord = new JTextField(30);

    btnRun.setFont(new Font("Comic Sans MS", Font.BOLD, 25));
    lblTitle.setFont(new Font("Comic Sans MS", Font.BOLD, 40));

    listener = new ButtonListener();

    btnRun.addActionListener(listener);

    cp.add(lblTitle);
    cp.add(txtWord);
    cp.add(btnRun);

    setSize(400, 200);
    setVisible(true);
    setResizable(false);
  }
  /** Inits the layout. */
  private void initLayout() {
    self = this;
    window = JSObject.getWindow(self);
    // fileLocation.setEditable(false);
    fileNameField = new JTextField(25);
    fileNameField.setEditable(false);
    fileNameField.setBackground(Color.WHITE);

    chooseBtn = new JButton();
    chooseBtn.setText(getMessage(MessageCode.FTP_FILE_CHOOSE));

    uploadBtn = new JButton();
    uploadBtn.setText(getMessage(MessageCode.FTP_FILE_UPLOAD));
    uploadBtn.setEnabled(false);

    fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(getMessage(MessageCode.FTP_FILECHOOSER_TITLE));
    fileChooser.setAcceptAllFileFilterUsed(false);

    final boolean filterTypes = StringUtils.isNotBlank(allowTypes);
    final boolean filterMaxSize = maxSize > 0;

    if (filterTypes || filterMaxSize) {
      fileChooser.setFileFilter(
          new FileFilter() {
            @Override
            public String getDescription() {
              return filterTypes
                  ? getMessage(MessageCode.ALLOW_ALL_FILE)
                  : getMessage(MessageCode.ALLOW_SOME_FILE) + allowTypes;
            }

            @Override
            public boolean accept(File f) {

              if (f.isDirectory()) {
                return true;
              }

              boolean flag = true;
              if (filterTypes) {
                flag = false;
                String ext = FilenameUtils.getExtension(f.getName());
                String[] types = StringUtils.split(allowTypes, ",");
                for (String t : types) {
                  if (StringUtils.equalsIgnoreCase(t, ext)) {
                    flag = true;
                    break;
                  }
                }
              }

              if (flag && filterMaxSize) {
                flag = FileUtils.sizeOf(f) <= maxSize;
              }

              return flag;
            }
          });
    }

    progressInfo = new JLabel(getMessage(MessageCode.FTP_UPLOAD_PROGRESS));

    progressBar = new JProgressBar(0, 100);
    progressBar.setPreferredSize(new Dimension(380, 20));
    // progressBar.setString("请选择文件");
    progressBar.setStringPainted(true);
    progressBar.setBorderPainted(true);
    // progressBar.setBackground(Color.gray);
    // progressBar.setForeground(Color.blue);

    progressPanel = new JPanel();
    progressPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    progressPanel.add(progressInfo);
    progressPanel.add(progressBar);
    progressPanel.setBackground(Color.WHITE);
    progressPanel.setVisible(false);

    // main.add(fileLocation);
    selectPanel = new JPanel();
    selectPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    selectPanel.add(fileNameField);
    selectPanel.add(chooseBtn);
    selectPanel.add(uploadBtn);
    selectPanel.setBackground(Color.WHITE);

    GridLayout layout = new GridLayout(2, 1);
    Container container = self.getContentPane();
    container.setLayout(layout);
    container.add(selectPanel);
    container.add(progressPanel);
    container.setBackground(Color.WHITE);
  }
Beispiel #27
0
  // gui constructor
  public Gui() throws IOException {

    // sets frame text and features
    super("Doge Clicker 1.0");
    this.setIconImage(new ImageIcon("Images//doge.jpg").getImage());

    // initializes sound files
    Sounds.initialize();

    // gui dimensions and features
    setSize(1000, 700);
    setResizable(false);
    setLayout(null);
    Container c = getContentPane();
    c.setBackground(new Color(255, 255, 255));
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    // timer for doge per second run method runs every millisecond
    timer = new Timer();
    timer.schedule(new RemindTask(), 1000, 10);

    // bolded title
    title = new JLabel("Doge Clicker v1.0");
    title.setBounds(0, 0, getWidth(), 40);
    title.setFont(new Font("Comic Sans MS", Font.BOLD, 26));
    title.setForeground(Color.white);
    title.setHorizontalAlignment(JLabel.CENTER);
    add(title);

    // reads news.txt to have import text to array
    String filePath = "Data\\news.txt";
    BufferedReader fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < line.length; i++) {

      // reads lines and saves until done reading
      if ((line[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close(); // close file

    // read flavor text.txt to import text to array
    filePath = "Data\\flavourtext.txt";
    fileIn = new BufferedReader(new FileReader(filePath));
    for (int i = 0; i < flavourText.length; i++) {

      // reads lines until complety reading
      if ((flavourText[i] = fileIn.readLine()) != null) {}
    }
    fileIn.close();

    // flavour label that pops up randomly when doge is clicked
    flavourClick = new JLabel("Wow! Such click!");
    flavourClick.setBounds(400, 100, getWidth(), getHeight());
    flavourClick.setFont(new Font("Comic Sans MS", Font.BOLD, 25));
    flavourClick.setForeground(Color.white);
    flavourClick.setOpaque(false);
    add(flavourClick);

    // label for achievements
    achievementText = new JLabel("These are your achievements");
    achievementText.setBounds(75, 2, getWidth(), 15);
    achievementText.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    achievementText.setForeground(Color.white);
    add(achievementText);

    // label for doge buying and click upgrades
    dogeProducers = new JLabel("Buy to make more doge");
    dogeProducers.setBounds(50, 160, getWidth(), 40);
    dogeProducers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeProducers.setForeground(Color.white);
    add(dogeProducers);
    dogeClickers = new JLabel("Miscellaneous upgrades wow");
    dogeClickers.setBounds(700, 160, getWidth(), 40);
    dogeClickers.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClickers.setForeground(Color.white);
    add(dogeClickers);

    // doge click button
    dogeClick = new JButton(new ImageIcon("Images/doge.jpg"));
    dogeClick.addActionListener(this);
    dogeClick.setBounds(450, 100, 100, 100);
    dogeClick.setOpaque(false);
    dogeClick.setBorder(BorderFactory.createLineBorder(Color.black));
    dogeClick.setToolTipText("Each click gives you " + clickUpgrade + " doge. wow");
    add(dogeClick);

    // click multiplier
    clickMultiplier = new JLabel(multiplier + "x");
    clickMultiplier.setBounds(570, 120, getWidth(), 50);
    clickMultiplier.setFont(new Font("Comic Sans MS", Font.BOLD, 30));
    clickMultiplier.setForeground(Color.white);
    add(clickMultiplier);
    // clicks per second indicator
    cpsIndicator = new JLabel(cps + " clicks per second");
    cpsIndicator.setBounds(570, 150, getWidth(), 50);
    cpsIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 10));
    cpsIndicator.setForeground(Color.white);
    add(cpsIndicator);

    // event indicator
    eventIndicator = new JLabel("Welcome to doge clicker!");
    eventIndicator.setBounds(700, 530, getWidth(), 50);
    eventIndicator.setFont(new Font("Comic Sans MS", Font.BOLD, 15));
    eventIndicator.setForeground(Color.white);
    add(eventIndicator);

    // states the num of doge and doge per second
    dogeCount = new JLabel("Doge: " + doge);
    dogeCount.setBounds(0, 0, getWidth(), 120);
    dogeCount.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
    dogeCount.setForeground(Color.white);
    dogeCount.setHorizontalAlignment(JLabel.CENTER);
    add(dogeCount);
    dogePerSecond = new JLabel("You get " + dps + " doge per second");
    dogePerSecond.setBounds(0, 25, getWidth(), 120);
    dogePerSecond.setFont(new Font("Comic Sans MS", Font.BOLD, 11));
    dogePerSecond.setForeground(Color.white);
    dogePerSecond.setHorizontalAlignment(JLabel.CENTER);
    add(dogePerSecond);
    dogeClicktext = new JLabel("Click for more doge");
    dogeClicktext.setBounds(400, 185, 200, 50);
    dogeClicktext.setFont(new Font("Comic Sans MS", Font.BOLD, 13));
    dogeClicktext.setForeground(Color.white);
    dogeClicktext.setHorizontalAlignment(JLabel.CENTER);
    add(dogeClicktext);
    // doge button testing button
    devButton = new JButton(new ImageIcon());
    devButton.addActionListener(this);
    devButton.setBounds(0, 0, 50, 50);
    devButton.setToolTipText("Such Secret");
    devButton.setOpaque(false);
    devButton.setContentAreaFilled(false);
    devButton.setBorderPainted(false);
    add(devButton);

    // options and save buttons
    options = new JButton(new ImageIcon("Images/option.png"));
    options.addActionListener(this);
    options.setBounds(900, 10, 70, 70);
    options.setOpaque(false);
    options.setBorder(BorderFactory.createLineBorder(Color.black));
    options.setToolTipText("Go to options");
    add(options);
    save = new JButton(new ImageIcon("Images/save.png"));
    save.addActionListener(this);
    save.setBounds(820, 10, 70, 70);
    save.setOpaque(false);
    save.setBorder(BorderFactory.createLineBorder(Color.black));
    save.setToolTipText("Save a file");
    add(save);
    open = new JButton(new ImageIcon("Images/open.png"));
    open.addActionListener(this);
    open.setBounds(740, 10, 70, 70);
    open.setOpaque(false);
    open.setBorder(BorderFactory.createLineBorder(Color.black));
    open.setToolTipText("Open a file");
    add(open);

    // news headline label that will move
    for (int i = 0; i < 3; i++) {

      newsHeadline[i] = new JLabel("Welcome to Doge clicker this is a news headline!");
      newsHeadline[i].setBounds(-200 - (475 * i), 615, getWidth(), 40);
      newsHeadline[i].setFont(new Font("Comic Sans MS", Font.BOLD, 13));
      newsHeadline[i].setForeground(Color.white);
      add(newsHeadline[i]);
    }

    // create all buttons and button stats and labels for producers
    for (int i = 0; i < MAX_UPGRADES; i++) {

      producerStats[i] = new Producers(i);
      producers[i] = new JButton(new ImageIcon(producerStats[i].getImage()));
      producers[i].addActionListener(this);
      producers[i].setOpaque(false);
      producers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      producers[i].setToolTipText(
          "Your "
              + producerStats[i].getButtonName()
              + " gives "
              + producerStats[i].getDogeProduction() * producerStats[i].getCount()
              + " doge per second");
      producers[i].setBounds(0, 0, 70, 70);

      buyProducers[i] =
          new JLabel(
              "Buy "
                  + producerStats[i].getButtonName()
                  + " for "
                  + producerStats[i].getCost()
                  + " doge");
      buyProducers[i].setBounds(0, 0, getWidth(), 100);
      buyProducers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyProducers[i].setForeground(Color.white);

      buyDetails[i] =
          new JLabel(
              "You have: " + producerStats[i].getCount() + " " + producerStats[i].getButtonName());
      buyDetails[i].setBounds(0, 0, getWidth(), 100);
      buyDetails[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyDetails[i].setForeground(Color.white);
    }
    // buttons and labels for click upgrades clickers
    for (int i = 0; i < MAX_CLICK; i++) {

      clickerStats[i] = new Clickers(i);
      clickers[i] = new JButton(new ImageIcon(clickerStats[i].getImage()));
      clickers[i].addActionListener(this);
      if (clickerStats[i].getClickMultiplier() == 1) {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get +"
                + clickerStats[i].getClickBonus()
                + " doge per click");
      } else {
        clickers[i].setToolTipText(
            "Buy this "
                + clickerStats[i].getButtonName()
                + " to get x"
                + clickerStats[i].getClickMultiplier()
                + " doge per click");
      }
      clickers[i].setOpaque(false);
      clickers[i].setBorder(BorderFactory.createLineBorder(Color.black));
      clickers[i].setBounds(0, 0, 70, 70);

      buyClickers[i] =
          new JLabel(
              "Buy "
                  + clickerStats[i].getButtonName()
                  + " for "
                  + clickerStats[i].getCost()
                  + " doge");
      buyClickers[i].setBounds(0, 0, getWidth(), 100);
      buyClickers[i].setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
      buyClickers[i].setForeground(Color.white);
    }

    // labels for achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {
      achievementStats[i] = new Achievements(i);
      achievements[i] = new JLabel(new ImageIcon(achievementStats[i].getImage()));
      achievements[i].setBorder(BorderFactory.createLineBorder(Color.black));
      achievements[i].setToolTipText("Achievement: " + achievementStats[i].getButtonName());
      achievements[i].setBounds(0, 0, 70, 70);
    }

    // JPanel containing achievements
    JPanel achievementPanel = new JPanel();
    achievementPanel.setPreferredSize(new Dimension(350, 70));
    achievementPanel.setLayout(null);
    achievementPanel.setOpaque(false);

    // JScrollpane containing JPanel for achievements
    JScrollPane achievementDisplay = new JScrollPane();
    achievementDisplay.setViewportBorder(new LineBorder(Color.black));
    achievementDisplay.setSize(280, 90);
    achievementDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    achievementDisplay.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    achievementDisplay.getVerticalScrollBar().setUnitIncrement(10);
    achievementDisplay.setLocation(50, 20);
    achievementDisplay.setOpaque(false);
    add(achievementDisplay);

    // adds the panel
    achievementDisplay.getViewport().add(achievementPanel);
    achievementDisplay.getViewport().setOpaque(false);

    // adds all achievements
    for (int i = 0; i < MAX_ACHIEVEMENTS; i++) {

      achievementPanel.add(achievements[i]);
      achievements[i].setLocation(0 + i * 70, 0);
      achievements[i].setVisible(false);
    }

    // jpanel containing upgrades for producers
    JPanel upgradePanel = new JPanel();
    upgradePanel.setPreferredSize(new Dimension(350, 770));
    upgradePanel.setLayout(null);
    upgradePanel.setOpaque(false);

    // Jscrollpane containing jpanel for producers
    JScrollPane producerUpgrades = new JScrollPane();
    producerUpgrades.setViewportBorder(new LineBorder(Color.black));
    producerUpgrades.setSize(350, 300);
    producerUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    producerUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    producerUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    producerUpgrades.setLocation(0, 200);
    producerUpgrades.setOpaque(false);
    add(producerUpgrades);

    producerUpgrades.getViewport().setOpaque(false);
    producerUpgrades.getViewport().add(upgradePanel);

    // adds all upgrades
    for (int i = 0; i < MAX_UPGRADES; i++) {

      upgradePanel.add(producers[i]);
      producers[i].setLocation(0, (i) * 70);
      upgradePanel.add(buyProducers[i]);
      buyProducers[i].setLocation(90, (i * 70) - 35);
      upgradePanel.add(buyDetails[i]);
      buyDetails[i].setLocation(90, (i * 70) - 20);
    }

    // jpanel containing upgrades for clickers
    JPanel clickPanel = new JPanel();
    clickPanel.setPreferredSize(new Dimension(350, 350));
    clickPanel.setLayout(null);
    clickPanel.setOpaque(false);

    // Jscrollpane containing jpanel for clickers
    JScrollPane clickUpgrades = new JScrollPane();
    clickUpgrades.setViewportBorder(new LineBorder(Color.black));
    clickUpgrades.setSize(350, 300);
    clickUpgrades.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    clickUpgrades.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    clickUpgrades.getVerticalScrollBar().setUnitIncrement(10);
    clickUpgrades.setLocation(650, 200);
    clickUpgrades.setOpaque(false);
    add(clickUpgrades);
    clickUpgrades.getViewport().add(clickPanel);
    clickUpgrades.getViewport().setOpaque(false);

    // adds all click upgrades
    for (int i = 0; i < MAX_CLICK; i++) {

      clickPanel.add(clickers[i]);
      clickers[i].setLocation(0, (i) * 70);
      clickPanel.add(buyClickers[i]);
      buyClickers[i].setLocation(80, (i * 70) - 30);
    }

    // dancing snoop dog image
    JLabel snoop = new JLabel(new ImageIcon("Images//snoop.gif"));
    snoop.setBounds(450, 370, 150, 308);
    snoop.setOpaque(false);
    add(snoop);

    // background image
    JLabel background = new JLabel(new ImageIcon("Images//dogebackground.png"));
    background.setBounds(0, 0, 1000, 700);
    add(background);

    // makes everything above visible
    setVisible(true);
    // flavour click will remain invisible
    flavourClick.setVisible(false);

    // timer for news headline, runs every 20 milliseconds
    MyTimerTask task = new MyTimerTask();
    Timer newsTimer = new Timer();
    newsTimer.scheduleAtFixedRate(task, 0, 20);
  }
  public MenuSketchDialog() {
    setLocationRelativeTo(null);
    Container content = getContentPane();
    content.setBackground(Color.WHITE);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    panelBottom = new JPanel();
    panelBottom.setSize(200, 600);

    btnNewMenu = new JButton("New Menu");
    btnDelete = new JButton("Delete");
    btnGenerate = new JButton("Generate");

    panelBottom.add(btnNewMenu);
    panelBottom.add(btnDelete);
    panelBottom.add(btnGenerate);

    // create the root node
    root = new DefaultMutableTreeNode("Menus");

    // create the tree by passing in the root node
    tree = new JTree();
    tree.setShowsRootHandles(true);
    // tree.setRootVisible(false);

    workspace = new MenusWorkspace();
    workspace.setMenus(menus);
    menusTreeController = new MenusTreeController(tree, workspace);
    menusHierarchyModel = new MenusHierarchyModel(tree, workspace);

    tree.addMouseListener(menusTreeController);
    tree.addTreeSelectionListener(menusTreeController);
    menusHierarchyModel.addTreeModelListener(menusTreeController);
    tree.setModel(menusHierarchyModel);

    add(new JScrollPane(tree), BorderLayout.CENTER);
    add(panelBottom, BorderLayout.SOUTH);

    btnNewMenu.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            menusTreeController.openMenuDesignerPanel();
          }
        });

    btnDelete.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (selectedNode == null) return;

            Submenu temp = null;
            System.out.println("SELECTED NODE JE :" + selectedNode.getUserObject().toString());
            for (Submenu s : menus) {
              System.out.println("SUBMENU JE " + s.getName());
              if (s.getName().equals(selectedNode.getUserObject().toString())) temp = s;
            }
            if (temp != null) menus.remove(temp);

            DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent();
            if (parentNode != null) parentNode.remove(selectedNode);
            DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
            model.reload(parentNode);
          }
        });

    btnGenerate.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            MenuGenerator mgen = new MenuGenerator(menus);
            mgen.generate();
          }
        });

    this.pack();
    setLocationRelativeTo(null);
  }
  private void criaInterfaceVisualEscalavel() {
    miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR);
    painel = new JPanel();
    textAreaSourceCode = new G_TextAreaSourceCode();
    // frameSilvinha.setJMenuBar(this.criaMenuBar());
    textAreaSourceCode.setTipoHTML();
    textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE));
    // frameSilvinha.setTitle(XHTMLPanel.TIT_LINK_RED);

    painel.setLayout(new GridLayout(2, 1));
    setBackground(frameSilvinha.corDefault);

    Container contentPane = this;
    contentPane.setLayout(new GridLayout(1, 1));
    painel.add(textAreaSourceCode);

    JPanel panelBtnTabela = new JPanel();

    panelBtnTabela.setLayout(new BorderLayout());

    /*
     * Barra de botões
     */
    btnPanel = new JPanel();
    btnPanel.setLayout(null);
    btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR);
    btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR);
    btn_salvar.setBounds(10, 0, 150, 25);
    btnPanel.add(btn_salvar);

    btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR);
    btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR);
    btn_abrir.setBounds(165, 0, 150, 25);
    btnPanel.add(btn_abrir);

    btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO);
    btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO);
    btn_salvarComo.setBounds(320, 0, 150, 25);
    btnPanel.add(btn_salvarComo);

    btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR);
    btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR);
    btn_cancelar.setBounds(480, 0, 150, 25);
    btnPanel.add(btn_cancelar);

    btnPanel.setPreferredSize(new Dimension(430, 30));

    /*
     * Barra de correcao
     */
    btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR);
    btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR);
    btnAplicar.setEnabled(false);

    texto = new JTextField();

    texto.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel borda = new JPanel(new BorderLayout());
    JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO);
    lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO);
    borda.add(lbl_texto, BorderLayout.WEST);
    borda.add(texto, BorderLayout.CENTER);
    borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    borda.setOpaque(false);
    panelCorretor = new JPanel(new BorderLayout());
    panelCorretor.add(borda, BorderLayout.CENTER);
    panelCorretor.add(btnAplicar, BorderLayout.EAST);
    // panelCorretor.add(btnPanel,BorderLayout.WEST);
    panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    panelCorretor.setOpaque(false);

    /*
     * Tabela de erros
     */
    tabelaDeErros = new TabelaErros();
    scrollPaneTabela = new JScrollPane();
    scrollPaneTabela.setViewportView(tabelaDeErros);
    panelBtnTabela.add(panelCorretor, BorderLayout.NORTH);
    panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER);
    panelBtnTabela.add(btnPanel, BorderLayout.SOUTH);
    scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS));
    painel.add(panelBtnTabela);

    btnPanel.setBackground(frameSilvinha.corDefault);
    if (!original) {
      reverter = new JButton("Reverter");
      reverter.setText(TradPainelRelatorio.REVERTER);
      reverter.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
              setVisible(false);
              TxtBuffer.setContent(TxtBuffer.getContentOriginal());
              frameSilvinha.showPainelFerramentaLinksRedundantes();
              setVisible(true);
            }
          });
      // reverter.setActionCommand("Reverter");
      reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
      reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
      reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
      reverter.setBounds(640, 0, 150, 25);
      btnPanel.add(reverter);
    }

    panelBtnTabela.setBackground(frameSilvinha.corDefault);
    painel.setBackground(frameSilvinha.corDefault);
    contentPane.setBackground(frameSilvinha.corDefault);
    scrollPaneTabela.setBackground(frameSilvinha.corDefault);
    textAreaSourceCode.setBackground(frameSilvinha.corDefault);
    miBtnSalvar.setEnabled(false);
    btn_salvar.setEnabled(false);
    salvaAlteracoes =
        TxtBuffer.getInstanciaSalvaAlteracoes(
            textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha);
    String fil[] = {".html", ".htm"};
    salvaAlteracoes.setFiltro(fil);
    contentPane.add(painel);
    // pack();
    this.setVisible(true);
  }
  EndUser() {
    setTitle("RemoteUser::An Approach For Content Delivery In Cloud");
    c = getContentPane();
    c.setLayout(null);

    /*	 ImageIcon banner = new ImageIcon(this.getClass().getResource("EndUser.png"));
    JLabel title = new JLabel();
    title.setIcon(banner);
    title.setBounds(-10, 0, 650,100);*/

    pane.setBounds(250, 100, 320, 280);

    tf.setColumns(100);
    tf.setForeground(Color.black);
    tf.setFont(f1);
    tf.setRows(200);
    tf.setName("tf");
    pane.setName("pane");
    pane.setViewportView(tf);
    c.add(pane, BorderLayout.CENTER);

    ImageIcon banner = new ImageIcon(this.getClass().getResource("RemoteUser.png"));
    JLabel title = new JLabel();
    title.setIcon(banner);
    title.setBounds(0, -10, 600, 110);

    ImageIcon banner1 = new ImageIcon(this.getClass().getResource("EndUserBanner.jpg"));
    JLabel title1 = new JLabel();
    title1.setIcon(banner1);
    title1.setBounds(-20, 100, 400, 250);

    j2 = new JButton("Download File");
    j2.setFont(f2);
    j2.setBounds(60, 420, 130, 30);
    j2.addActionListener(this);
    c.add(j2);

    j3 = new JButton("Request SKey");
    j3.setFont(f2);
    j3.setBounds(220, 420, 150, 30);
    j3.addActionListener(this);
    c.add(j3);

    Border b11 = BorderFactory.createLineBorder(Color.black, 2);
    TitledBorder t1 = new TitledBorder(b11);
    // t1.setTitle("Adding Query");
    t1.setTitleColor(Color.RED);
    // t1.setTitleFont(f1);

    JLabel l1 = new JLabel();
    l1.setBorder(t1);
    l1.setBounds(5, 90, 570, 300);
    c.add(l1);

    TitledBorder t2 = new TitledBorder(b11);
    // t2.setTitle("Query Retrival Using RASP");
    t2.setTitleColor(Color.RED);
    // t2.setTitleFont(f1);

    JLabel l2 = new JLabel();
    l2.setBorder(t2);
    l2.setBounds(5, 400, 570, 70);
    c.add(l2);

    j1 = new JButton("Exit");
    j1.setFont(f2);
    j1.setBounds(400, 420, 80, 30);
    j1.addActionListener(this);
    c.add(j1);

    c.setBackground(Color.white);
    c.add(title);
    c.add(title1);
    setSize(600, 515);
    setVisible(true);
  }