在Eclipse中使用調(diào)試程序最基本的操作是:
成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),鄧州企業(yè)網(wǎng)站建設(shè),鄧州品牌網(wǎng)站建設(shè),網(wǎng)站定制,鄧州網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,鄧州網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
1.首先在一個(gè)java文件中設(shè)斷點(diǎn),然后debug as--open debug Dialog,然后在對話框中選類后-- Run
當(dāng)程序走到斷點(diǎn)處就會(huì)轉(zhuǎn)到debug視圖下。
2.F5鍵與F6鍵均為單步調(diào)試,F(xiàn)5是step into,也就是進(jìn)入本行代碼中執(zhí)行,F(xiàn)6是step over,
也就是執(zhí)行本行代碼,跳到下一行,
3.F7是跳出函數(shù)
4.F8是執(zhí)行到最后。
1.Step Into (also F5) 跳入
2.Step Over (also F6) 跳過
3.Step Return (also F7) 執(zhí)行完當(dāng)前method,然后return跳出此method
4.step Filter 逐步過濾 一直執(zhí)行直到遇到未經(jīng)過濾的位置或斷點(diǎn)(設(shè)置Filter:window-preferences-java-Debug-step Filtering)
5.resume 重新開始執(zhí)行debug,一直運(yùn)行直到遇到breakpoint
6.hit count 設(shè)置執(zhí)行次數(shù) 適合程序中的for循環(huán)(設(shè)置 breakpoint view-右鍵hit count)
7.inspect 檢查 運(yùn)算。執(zhí)行一個(gè)表達(dá)式顯示執(zhí)行值
8.watch 實(shí)時(shí)地監(jiān)視變量的變化
9.我們常說的斷點(diǎn)(breakpoints)是指line breakpoints,除了line breakpoints,還有其他的斷點(diǎn)類型:field(watchpoint)breakpoint,method breakpoint,exception breakpoint.
10.field breakpoint 也叫watchpoint(監(jiān)視點(diǎn)) 當(dāng)成員變量被讀取或修改時(shí)暫掛
11.添加method breakpoint 進(jìn)入/離開此方法時(shí)暫掛(Run-method breakpoint)
12.添加Exception breakpoint 捕抓到Execption時(shí)暫掛(待續(xù)...)
斷點(diǎn)屬性:
1.hit count 執(zhí)行多少次數(shù)后暫掛 用于循環(huán)
2.enable condition 遇到符合你輸入條件(為ture\改變時(shí))就暫掛
3.suspend thread 多線程時(shí)暫掛此線程
4.suspend VM 暫掛虛擬機(jī)
13.variables 視圖里的變量可以改變變量值,在variables 視圖選擇變量點(diǎn)擊右鍵--change value.一次來進(jìn)行快速調(diào)試。
14.debug 過程中修改了某些code后--〉savebuild--resume--重新暫掛于斷點(diǎn)?JSP的調(diào)試:1.將tomcat以debug的模式啟動(dòng)。(java web servers)
2.選擇要調(diào)試的jsp,open with jsp editor
3.選擇jsp文件,debug。出現(xiàn)ajax插件,直接點(diǎn)就行了
利用JAVA類庫中的CheckboxGroup,具體可以參考API,
然后將性別選項(xiàng)(Checkbox)添加到CheckboxGroup中去。
這樣就在任何時(shí)刻都有且僅有一個(gè)被選中了。
你可以去試下。很簡單的。
public static void main ( String args[])
{
new MenuTest().setVisible(true);
}
}
不要寫在另一個(gè)方法內(nèi)。
另外,是這個(gè)名稱的
PopupMenu pop;
import?java.awt.BorderLayout;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.util.Enumeration;
import?javax.swing.JButton;
import?javax.swing.JFrame;
import?javax.swing.JPanel;
import?javax.swing.JScrollPane;
import?javax.swing.JSplitPane;
import?javax.swing.JTabbedPane;
import?javax.swing.JTree;
import?javax.swing.SwingUtilities;
import?javax.swing.event.TreeSelectionEvent;
import?javax.swing.event.TreeSelectionListener;
import?javax.swing.table.DefaultTableModel;
import?javax.swing.tree.DefaultMutableTreeNode;
import?javax.swing.tree.MutableTreeNode;
import?javax.swing.tree.TreeNode;
public?class?Tabbepan_test?extends?JFrame{
private?static?final?long?serialVersionUID?=?7382825389354474881L;
JPanel?contpane,p1,p2,p3,p4,p5,p6,p7;
JScrollPane?jsc,jsc1;
JButton?btn;
JTabbedPane?tabp;
JTree?tree;
JSplitPane?jsp;
DefaultMutableTreeNode?node,top;??
DefaultTableModel?tableModel;
public?Tabbepan_test(){
super();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
contpane?=?new?JPanel(new?BorderLayout());
p1?=?new?JPanel();
p2?=?new?JPanel();
p3?=?new?JPanel();
p4?=?new?JPanel();
p5?=?new?JPanel();
p6?=?new?JPanel();
p7?=?new?JPanel();
node?=?new?DefaultMutableTreeNode("功能導(dǎo)航");
node.add(new?DefaultMutableTreeNode("人事管理"));
node.add(new?DefaultMutableTreeNode("生產(chǎn)管理"));
node.add(new?DefaultMutableTreeNode("資材管理"));
node.add(new?DefaultMutableTreeNode("營銷管理"));
node.add(new?DefaultMutableTreeNode("財(cái)務(wù)管理"));
node.add(new?DefaultMutableTreeNode("總務(wù)管理"));
node.add(new?DefaultMutableTreeNode("系統(tǒng)維護(hù)"));
top?=?new?DefaultMutableTreeNode("ERP系統(tǒng)");
top.add(node);
tree?=?new?JTree(top);
tabp?=?new?JTabbedPane();
tabp.add("人事管理",?new?JScrollPane(p1));
tabp.add("生產(chǎn)管理",?new?JScrollPane(p2));
tabp.add("資材管理",?new?JScrollPane(p3));
tabp.add("營銷管理",?new?JScrollPane(p4));
tabp.add("財(cái)務(wù)管理",?new?JScrollPane(p5));
tabp.add("總務(wù)管理",?new?JScrollPane(p6));
tabp.add("系統(tǒng)維護(hù)",?new?JScrollPane(p7));
tree.addTreeSelectionListener(new?TreeSelectionListener()?{
@Override
public?void?valueChanged(TreeSelectionEvent?e)?{
//?TODO?自動(dòng)生成的方法存根
DefaultMutableTreeNode?nodes=(DefaultMutableTreeNode)?tree.getLastSelectedPathComponent();
String?tn?=?null;
int?b?=?tabp.getTabCount();
for(int?i=0;itabp.getTabCount();i++){
tn?=?tabp.getTitleAt(i).toString();
if(tn.equals(nodes.toString())){
tabp.addTab(nodes.toString(),?p1);
}else?{
}
}
}
});
jsp?=?new?JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
jsp.setDividerSize(1);
jsp.setDividerLocation(170);
jsp.setOneTouchExpandable(false);//讓分割線顯示出箭頭
jsp.setContinuousLayout(true);//操
jsc1?=?new?JScrollPane(tree);
jsp.setLeftComponent(jsc1);
jsp.setRightComponent(tabp);
contpane.add(jsp,BorderLayout.CENTER);
setContentPane(contpane);
setSize(800,600);
setLocationRelativeTo(null);
}
public?static?void?main(String[]?args)?{
//?TODO?自動(dòng)生成的方法存根
SwingUtilities.invokeLater(new?Runnable()?{
@Override
public?void?run()?{
//?TODO?自動(dòng)生成的方法存根
Tabbepan_test?test?=?new?Tabbepan_test();
test.setVisible(true);
}
});
}
import?java.awt.Checkbox;
import?java.awt.CheckboxGroup;
import?java.awt.Choice;
import?java.awt.FlowLayout;
import?java.awt.Label;
import?java.awt.TextField;
import?java.awt.event.ItemEvent;
import?java.awt.event.ItemListener;
import?javax.swing.JFrame;
public?class?Choose?extends?JFrame?implements?ItemListener?{
/**
*?
*/
private?static?final?long?serialVersionUID?=?1L;
Label?l1,?l2;
TextField?t1,?t2;
CheckboxGroup?checkboxGroup?=?new?CheckboxGroup();
Checkbox?checkbox1?=?new?Checkbox("QQ",?checkboxGroup,?false);
Checkbox?checkbox2?=?new?Checkbox("MSN",?checkboxGroup,?false);
Checkbox?checkbox3?=?new?Checkbox("ICQ",?checkboxGroup,?false);
Choice?c;
public?Choose()?{
super("簡單小程序");
this.setLayout(new?FlowLayout());
l1?=?new?Label("選擇你常用的軟件:");
l2?=?new?Label("選擇你喜歡的水果:");
checkbox1.addItemListener(this);
checkbox2.addItemListener(this);
checkbox3.addItemListener(this);
t1?=?new?TextField(20);
t2?=?new?TextField(20);
c?=?new?Choice();
c.addItemListener(this);
c.add("蘋果");
c.add("橘子");
c.add("香蕉");
c.add("梨子");
this.add(l1);
this.add(checkbox1);
this.add(checkbox2);
this.add(checkbox3);
this.add(t1);
this.add(l2);
this.add(c);
this.add(t2);
this.setSize(450,?200);
this.setVisible(true);
}
public?static?void?main(String[]?args)?{
new?Choose();
}
public?void?itemStateChanged(ItemEvent?e)?{
if?(e.getSource()?==?checkbox1)?{
t1.setText("你常用的軟件是:"?+?checkbox1.getLabel());
}
if?(e.getSource()?==?checkbox2)?{
t1.setText("你常用的軟件是:"?+?checkbox2.getLabel());
}
if?(e.getSource()?==?checkbox3)?{
t1.setText("你常用的軟件是:"?+?checkbox3.getLabel());
}
t2.setText("你喜歡的水果是:"?+?c.getSelectedItem());//?得到選中的下拉列表值
}
}
網(wǎng)頁標(biāo)題:java選項(xiàng)表代碼 java選擇框代碼
網(wǎng)頁地址:http://jinyejixie.com/article0/hepiio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、微信小程序、定制網(wǎng)站、手機(jī)網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)、建站公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)