java多级菜单代码 java菜单栏代码( 五 )


}
eJoin.src = https://www.04ip.com/post/(this.config.useLines)?
((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
((status)?this.icon.nlMinus:this.icon.nlPlus);
eDiv.style.display = (status) ? 'block': 'none';
};
// [Cookie] Clears a cookie
dTree.prototype.clearCookie = function() {
var now = new Date();
var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
this.setCookie('co'+this.obj, 'cookieValue', yesterday);
this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
};
// [Cookie] Sets value in a cookie
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
document.cookie =
escape(cookieName) + '=' + escape(cookieValue)
+ (expires ? '; expires=' + expires.toGMTString() : '')
+ (path ? '; path=' + path : '')
+ (domain ? '; domain=' + domain : '')
+ (secure ? '; secure' : '');
};
// [Cookie] Gets a value from a cookie
dTree.prototype.getCookie = function(cookieName) {
var cookieValuehttps://www.04ip.com/post/= '';
var posName = document.cookie.indexOf(escape(cookieName) + '=');
if (posName != -1) {
var posValue = https://www.04ip.com/post/posName + (escape(cookieName) +'=').length;
var endPos = document.cookie.indexOf(';', posValue);
if (endPos != -1) cookieValue = https://www.04ip.com/post/unescape(document.cookie.substring(posValue, endPos));
else cookieValue = https://www.04ip.com/post/unescape(document.cookie.substring(posValue));
}
return (cookieValue);
};
// [Cookie] Returns ids of open nodes as a string
dTree.prototype.updateCookie = function() {
var str = '';
for (var n=0; nthis.aNodes.length; n++) {
if (this.aNodes[n]._iothis.aNodes[n].pid != this.root.id) {
if (str) str += '.';
str += this.aNodes[n].id;
}
}
this.setCookie('co' + this.obj, str);
};
// [Cookie] Checks if a node id is in a cookie
dTree.prototype.isOpen = function(id) {
var aOpen = this.getCookie('co' + this.obj).split('.');
for (var n=0; naOpen.length; n++)
if (aOpen[n] == id) return true;
return false;
};
// If Push and pop is not implemented by the browser
if (!Array.prototype.push) {
Array.prototype.push = function array_push() {
for(var i=0;iarguments.length;i++)
this[this.length]=arguments[i];
return this.length;
}
};
if (!Array.prototype.pop) {
Array.prototype.pop = function array_pop() {
lastElement = this[this.length-1];
this.length = Math.max(this.length-1,0);
return lastElement;
}
};
java 如何用用数组设置一个窗体的三级菜单?这不简单吗java多级菜单代码,直接循环加上去就可以java多级菜单代码了 。
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class List extends JFrame{
public List(){
initialization();
setTitle("三级菜单");
setBounds(300,300,400,300);
setLayout(null);
Container c=getContentPane();
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public void initialization(){
JMenu jmenuTwo=null;
String[] menubar={"编辑","帮助"};
String[][] submenu={{"复制","粘贴","","历史记录"},{"关于三级菜单"}};
String[] threemenu={"撤消","恢复"};
JMenuBar jmenubar=new JMenuBar();//创建菜单栏
for(int i=0;imenubar.length;i++){
JMenu jmenu=new JMenu(menubar[i]);
jmenubar.add(jmenu);
for(int j=0;jsubmenu[i].length;j++){
if("".equals(submenu[i][j])){
jmenu.addSeparator();//添加一条横线
}else{
jmenuTwo=new JMenu(submenu[i][j]);

推荐阅读