JavaGUI,交互和切换场景

问题描述

我目前正在开发一个用Java制作GUI的项目。我在用Java制作gui方面很陌生,因此gui看起来很丑。我想知道是否有一种特殊的方式来改变场景,或者我是否只需要在另一个班级中结识新朋友并提供按钮操作来打开另一个GUI。我认为有一种更简单的方法,但我还没有做很多研究。

我想知道如何做到这一点,以便在按下添加按钮时实现。一个小的垂直区域将在scroolpane中弹出,我可以在其中创建多个区域,并且它们可以相互堆叠。事物上还会有不同的按钮。和文本一样,某些文本在我开始时需要进行自我更新。这样用户就有机会查看发生了什么。

因此,我需要有关如何制作和更新文本的帮助,以使其显示不同的刺痛。 Like this just with buttons on the end.

我还可以同时选择一个或多个这些“任务”。

我了解我是否要求很多,但我真的希望这件事能奏效。

如果您想知道我正在尝试制作一个自动从其他网站购买商品的机器人或程序。这可能是鞋子或衣服。这也称为运动鞋机器人,但我正计划使其购买其他东西。我要制作的东西称为任务,它将请求发送到网站并进行购买,并且将这些请求进行多次处理就可以更轻松地购买所需的商品。

如果有人提出了一些技巧或窍门,我也将不胜感激。

最后一件事是,如果有人对代理有任何经验,并向网站提出不同的请求,则会抛出代理。

谢谢您的时间。

只需在评论中询问您是否想知道什么。

这是我当前的代码

   import java.awt.BorderLayout;
   import java.awt.EventQueue;
   import java.awt.Font;
   import java.awt.event.ActionEvent;
   import java.awt.event.ActionListener;

   import javax.swing.JButton;
   import javax.swing.JFrame;
   import javax.swing.JPanel;
   import javax.swing.JToolBar;
   import javax.swing.border.EmptyBorder;

   public class profileGUIPane extends JFrame {

       private JFrame guiPane;

    /**
    * Launch the application.
    */

   /**
    * Create the frame.
    */
   
       public profileGUIPane() {
           initialize();
       }
   
   
       public void initialize() {
           guiPane = new JFrame();
           guiPane.setTitle("title");
           guiPane.setFont(new Font("Times New Roman",Font.PLAIN,12));
           guiPane.setBounds(100,100,613,331);
           guiPane.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
       
           JToolBar toolBar = new JToolBar();
           f guiPane.getContentPane().add(toolBar,BorderLayout.norTH);
       
           JButton mainpane = new JButton("maingui");
           tasksPane.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
               }
           });
           toolBar.add(mainpane);
       
           JButton secpane = new JButton("secondgui");
           profilePane.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
               }
           });
           toolBar.add(secpane);
       
           JButton settingsPane = new JButton("Settings");
           settingsPane.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
               }
           });
           toolBar.add(settingsPane);
       
           JButton opane = new JButton(" ");
           proxiesPane.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
               }
           });
           toolBar.add(opane);
           JPanel startstop = new JPanel();
       startstop.setBackground(new Color(255,153,153));
       frmCubeAio.getContentPane().add(startstop,BorderLayout.soUTH);
       
       JButton startAll = new JButton("Start");
       startstop.add(startAll);
       startAllTasks.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
           }
       });
       
       JButton stopAll = new JButton("Stop");
       startstop.add(stopAll);
       stopAllTasks.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
           }
       });
       
       JPanel edit = new JPanel();
       edittask.setBackground(new Color(222,184,135));
       frmCubeAio.getContentPane().add(edit,BorderLayout.WEST);
       
       Box Box = Box.createVerticalBox();

       
       JButton add = new JButton("Add");
       Box.add(add);
       addTask.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
               
           }
       });
       
       Component verticalStrut = Box.createVerticalStrut(20);
       Box.add(verticalStrut);
       
       JButton edit = new JButton("Edit");
       edit.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
           }
       });
       Box.add(edit);
       
       Component verticalStrut_1 = Box.createVerticalStrut(20);
       Box.add(verticalStrut_1);
       
       JButton remove = new JButton("Remove");
       Box.add(remove);
       removeTask.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
           }
       });
       
       Component verticalStrut_2 = Box.createVerticalStrut(20);
       Box.add(verticalStrut_2);
       
       JButton clone = new JButton("Clone");
       Box.add(clone);
       cloneTask.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent e) {
           }
       });
       
       edittask.add(Box);
       
       JScrollPane help = new JScrollPane();
       frmCubeAio.getContentPane().add(help,BorderLayout.CENTER);
       }
       
   }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)