jnframe.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 141 行
JAVA
141 行
package org.jnode.wt.components;
import org.jnode.wt.layouts.JNBorderLayout;
import java.awt.peer.FramePeer;
import java.awt.Image;
import java.awt.MenuBar;
import java.awt.Rectangle;
/**
* @author Kishore
*/
public class JNFrame extends JNWindow implements FramePeer{
/**/
private JNMenuBar menubar = null;
private JNPanel componentsPanel = new JNPanel();
/**
* JNFrame constructor comment.
*/
public JNFrame() {
super();
init();
}
/**
* JNFrame constructor comment.
* @param hasTitleBar boolean
*/
public JNFrame(boolean hasTitleBar) {
super(hasTitleBar);
init();
}
public org.jnode.wt.components.JNComponent add(org.jnode.wt.components.JNComponent comp) {
if ((comp == componentsPanel) || (comp == menubar)) {
super.add(comp);
return comp;
}
componentsPanel.add(comp);
return comp;
}
public JNMenuBar getMenuBar() {
return menubar;
}
private void init() {
componentsPanel.setName("componentspanel");
super.setLayout(new JNBorderLayout());
super.add(componentsPanel, JNBorderLayout.CENTER);
// setBackground( JNDefaultLookAndFeel.BackgroundColor );
//-componentsPanel.setLayout(new JNFlowLayout());
//-componentsPanel.setSize(200, 400);
//componentsPanel.setLocation(0,0);
/* for(int i =0;i<5;i++)
{
componentsPanel.add(new JNButton("xydedz"+i));
}*/
// componentsPanel.layout();
}
public void remove(org.jnode.wt.components.JNComponent comp) {
componentsPanel.remove(comp);
}
public void setMenuBar(JNMenuBar mb) {
menubar = mb;
if (menubar != null) {
menubar.setParent(this);
// menubar.setLocation(0,0);
// menubar.setSize(menubar.getPreferredSize());
//- menubar.setSize(300, 30);
/* MEnu will be added to the top of the Frame */
super.add(menubar, JNBorderLayout.NORTH);
super.layout();
menubar.layout();
}
// setSize(this.getWidth(), this.getHeight());
}
public void setIconImage(Image image) {
//TODO: implement it
}
public void setMenuBar(MenuBar mb) {
//TODO: implement it
}
public void setResizable(boolean resizable) {
//TODO: implement it
}
public void setTitle(String title) {
//TODO: implement it
}
public void toBack() {
//TODO: implement it
}
public void toFront() {
//TODO: implement it
}
public void setMaximizedBounds(Rectangle rect){
//TODO: implement it
}
public void setState(int state){
//TODO: implement it
}
public int getState(){
//TODO: implement it
return 0;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?