我用jbuild 与 jcrea ,不懂 ( 积分: 36 )

  • 主题发起人 主题发起人 FlyDayDream
  • 开始时间 开始时间
F

FlyDayDream

Unregistered / Unconfirmed
GUEST, unregistred user!
我用jcreat大部分代码要自己写,
用了jbuild之后,怎么写呀?
一会儿创建了很多文件.
比如 比如新建application 就怎么出现 一个 frame 我也可能创建frame ,
一个项目有多个application 和多个frame, 有多个frame我能理解,但有多个application我就纳闷了.
//applicaiton1.java ====================================
package fm2;
import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;
/**
* <p>Title: 测试frame</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Application1 {
boolean packFrame = false;
/**
* Construct and show the application.
*/
public Application1() {
Frame1 frame = new Frame1();
// Validate frames that have preset sizes
// Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
} else
{
frame.validate();
}
// Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
/**
* Application entry point.
*
* @param args String[]
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.
getSystemLookAndFeelClassName());
} catch (Exception exception) {
exception.printStackTrace();
}
new Application1();
}
});
}
}
//fm1.java
package fm2;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* <p>Title: 测试frame</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame1 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(borderLayout1);
setSize(new Dimension(400, 300));
setTitle(&quot;Frame Title&quot;);
}
}
//==============================application1.java 对应创建 frame1.java


=================下面是application2.java 创建 frame2.java
package fm2;
import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;
/**
* <p>Title: 测试frame</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Application2 {
boolean packFrame = false;
/**
* Construct and show the application.
*/
public Application2() {
Frame3 frame = new Frame3();
// Validate frames that have preset sizes
// Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
} else
{
frame.validate();
}
// Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
/**
* Application entry point.
*
* @param args String[]
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.
getSystemLookAndFeelClassName());
} catch (Exception exception) {
exception.printStackTrace();
}
new Application2();
}
});
}
}

package fm2;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* <p>Title: 测试frame</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame3 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
public Frame3() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(borderLayout1);
setSize(new Dimension(400, 300));
setTitle(&quot;Frame Title&quot;);
}
}

还有 不是 Frame ,
public class Frame3 extends Frame {
为什么到了 jbuild中就变成了JFrame
public class Frame3 extends JFrame
难道用的开发工具不同,父类还不一样,难道是不一样的JDK?
 
我修改过,(delphi编写的程序),增加菜单,按纽以及给它们增加响应代码。
 
晕倒,有没有例子发一个,代码也可。
分可以在加。
wwle163@163.com
 
逆向工程,通过OD打开,然后在相应的一些0区域里加上我们自己的api函数,然后完成相应的功能。。
 
先修改资源,增加菜单项
然后增加事件响应函数
在响应函数中调用自己的DLL导出函数
 
网上有教程来着
 
这个有些麻烦
要用到汇编的知识
 
奥,这么麻烦。
短期估计是我搞不定。
 
期待中。。。
 
后退
顶部