導航:首頁 > 編程語言 > java中怎麼跳轉到文本框首頁

java中怎麼跳轉到文本框首頁

發布時間:2023-06-26 20:36:34

java文本框如何自動跳轉

一般不是按回車跳到下一個輸入框的!你按Tab鍵就會自動跳到下一個輸入框的!按回車一般都是提交表單!而且不需要怎麼弄!在一個表單里就好!

❷ java中怎麼由一個界面跳到另一個界面

package Action;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Demo1 {
JFrame frame=new JFrame();
JLabel label=new JLabel("文本幾行");
JTextField text=new JTextField();
JButton but=new JButton("確定");
public Demo1()
{
.setLayout(null);
frame.setSize(300, 200);
label.setBounds(50, 10, 70, 20);
text.setBounds(110, 10, 80, 20);
but.setBounds(200, 10, 80, 20);
but.addActionListener(new Listener());
frame.add(label);
frame.add(text);
frame.add(but);
frame.setVisible(true);
}
class Listener implements ActionListener{
public void actionPerformed(ActionEvent e){
if(e.getSource()==but){
Demo2.k=Integer.parseInt(text.getText());
new Demo2();
}
}
}
public static void main(String[] args){
new Demo1();
}
}

package Action;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
class Demo2 {
static int k;
JFrame frame=new JFrame();
public Demo2(){
frame.setLayout(null);
frame.setLayout(new GridLayout(k,1,3,3));
for(int i=0;i<k;i++){
JButton but=new JButton("按鈕");
frame.add(but);
}
frame.setSize(300, 200);
frame.setVisible(true);
}
}

❸ JAVA頁面跳轉

a頁面代碼
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> page A </TITLE>
<script language="javascript">
function newWin(){
var str = window.showModalDialog("pageB.html",null,"dialogWidth=400px;dialogHeight=300px");
if (typeof(str) == "undefined") {
alert("沒有傳回值來");

}else{
document.getElementById("mytext").value=str;
}
}
</script>
</HEAD>

<BODY>
<input type="text" id="mytext">
<input type="button" value="button" onclick="newWin();">
</BODY>
</HTML>

b頁面代碼
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Page B </TITLE>
<script language="javascript">
function colseWin(){
var returnValue = document.getElementById("mytext").value.trim;
window.returnValue=returnValue;
window.close();
}
</script>
</HEAD>

<BODY>
<input type="text" id="mytext">
<input type="button" value="保存並關閉" onclick="colseWin();">
</BODY>
</HTML>

=======================================================
把兩個文件保存到同級目錄下就可以了.

❹ java代碼怎麼訪問網頁:例如在java中編寫一段代碼能夠讓他跳到到百度的首頁

<jsp:forward page=""></jsp:forward>寫上你要跳轉的頁面地址就可以了,這個jsp標准動作

❺ java中如何使文本框輸入字元之後自動跳到下一文本框

給你寫了一個 Demo,注意 addKeyListener 那段,添加鍵盤監聽器以後用 grabFocus 可以強制轉換焦點。

----------------------------------------------
import javax.swing.*;
import java.awt.event.*;

public class Demo extends JFrame {
private JTextField txtInput1, txtInput2;

public Demo () {
super("Demo Program");
setSize(100, 130);
setLocationRelativeTo(null);
setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

txtInput1 = new JTextField();
txtInput1.setBounds(10, 10, 80, 30);
txtInput1.addKeyListener(new KeyAdapter() {
public void keyTyped (KeyEvent ke) {
txtInput2.grabFocus();
}
});

txtInput2 = new JTextField();
txtInput2.setBounds(10, 50, 80, 30);

add(txtInput1);
add(txtInput2);

setVisible(true);
}

public static void main (String args[]) {
new Demo();
}
}

閱讀全文

與java中怎麼跳轉到文本框首頁相關的資料

熱點內容
長江大學網課用什麼app 瀏覽:431
華中系統圖紙編程哪個刀好 瀏覽:38
地方債務數據在哪裡查看 瀏覽:932
掃描文件怎麼設置格式 瀏覽:957
蘋果郵箱主機名填什麼 瀏覽:630
多張圖片同一個文件夾 瀏覽:798
win7怎麼打開shs文件 瀏覽:481
怎麼把文件夾做成iso 瀏覽:164
繽客網站上的房價怎麼在哪裡修改 瀏覽:406
單片機c51計數器實驗代碼 瀏覽:990
宏編程滑鼠代表什麼意思 瀏覽:753
別人撿到蘋果6有用嗎 瀏覽:829
word文件用wps打開 瀏覽:477
macbook修改文件格式軟體 瀏覽:757
美版s7edge那個版本好 瀏覽:529
視頻隱藏在文件夾里 瀏覽:144
網路通訊基礎是什麼 瀏覽:209
辦公電腦文件管理 瀏覽:222
火化費報銷文件有哪些 瀏覽:998
大數據這本書怎麼樣 瀏覽:954

友情鏈接