我目前有一个JDialog通过createDialog()从我的实例调用方法创建JOptionPane:
JOptionPane pane = new JOptionPane(myPanel, JOptionPane.PLAIN_MESSAGE,JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
dialog = pane.createDialog(null, "");
Run Code Online (Sandbox Code Playgroud)
我希望能够去除从标题栏JDialog通过调用setUndecorated(true)到JDialog,但我得到一个IllegalComponentStateException: The dialog is displayable例外,当我尝试运行我的程序.
据我所知,在我调用之前没有显示对话框dialog.show(),这使我相信在实例化对话框之后,对话框确实是"可显示的",pane.createDialog()远远超出了我对JDialogAPI的理解.
我试图setVisible(false)在使用之前打电话setUndecorated(true),但无济于事.
任何帮助将被理解为如何或完全可以删除JDialog这种类型的标题栏.从正常JDialog情况中删除标题栏很容易,从许多其他类型问题的答案可以看出,但我似乎无法让它为JDialog创建的通过工作createDialog().
相关代码:
input= new JTextField(50);
input.addKeyListener(new ConsoleKeyListener());
input.addAncestorListener( new RequestFocusListener() );
field = new JTextArea();
field.setEditable(false);
field.setLineWrap(true);
JScrollPane area = new JScrollPane(field, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
field.setRows(10);
field.setText(consoleText); …Run Code Online (Sandbox Code Playgroud) 经过几个小时的搜索,我仍然有点难以登录后如何访问html页面.看看这里的各种其他帖子以及Jsoup API,我理解访问后的页面登录页面将需要一些这样的代码:
Connection.Response loginForm = Jsoup.connect("https://parentviewer.pisd.edu/")
.method(Connection.Method.GET)
.execute();
Document document = Jsoup.connect("https://parentviewer.pisd.edu/")
.data("username", "testUser")
.data("password", "testPass")
.data("LoginButton", "Login")
.cookies(loginForm.cookies())
.post();
Run Code Online (Sandbox Code Playgroud)
但是,我认为我的理解可能有些偏差,因为我仍然不能完全理解我应该为每个值添加什么.
例如,在网站上,我会使用输入名称="ctl00 $ ContentPlaceHolder1 $ portalLogin $ UserName"作为键,"testUser"作为值吗?
我接近这个任务的方法是否正确?任何帮助是极大的赞赏.