- 浏览: 211869 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
chen569844962:
博主,你好,这个代码貌似不太完整,不知道能不能共享一下带我给我 ...
JTable 导出 Excel 利用 jxl.jar -
z995204127:
我去,发多了,太激动
【原创】swing 按钮点击 调用swt窗口(SWT浏览器)browser -
z995204127:
楼主,我去,太尼玛给力了,我搞了一天没搞定,原来要用一个线程包 ...
【原创】swing 按钮点击 调用swt窗口(SWT浏览器)browser -
z995204127:
楼主,我去,太尼玛给力了,我搞了一天,原来要用一个线程包装下。 ...
【原创】swing 按钮点击 调用swt窗口(SWT浏览器)browser -
changhuzhao:
好用!
org/eclipse/ui/internal/util/SWTResourceUtil
对于现实JDesktopPane 现实滚动条有如下方法:
package test; import javax.swing.*; public class TJInternalFrame extends JFrame { Container container; JButton button; JDesktopPane desktop; JInternalFrame internalFrame; static int frameCount = 0; static final int xOffSet = 1; static final int yOffSet = 150; // 1.Constructor of the frame class. public TJInternalFrame() { // 2.Give title to the frame and get its content pane super("TJInternalFrame"); container = this.getContentPane(); // 3.Create a button and add it at the lower portion of frame; // also add an action listener. button = new JButton("Click to Create More Internal Frames"); button.addActionListener(new ButtonListener()); container.add(button, BorderLayout.SOUTH); // 方法一:JDesktopPane显示滚动条!!!!!! // desktop = new JDesktopPane();// holds the internal frame // JScrollPane scrollPane = new JScrollPane(); // scrollPane.getViewport().setView(desktop); // // desktop.setPreferredSize(new Dimension(1600, 2200)); // very // important // // container.add(scrollPane);// add the desktop to the main frame // 方法二:JDesktopPane显示滚动条!需要新建一个JDesktopPane的继承类JDesktop。!!!!! // ================================================================ desktop = new JDesktop(); JScrollPane scrollpane = new JScrollPane(desktop, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); container.add(scrollpane); // ================================================================ createInternalFrame();// create an internal frame // 5.Add the window listener, set the frame size, default close // operation and make the frame visible. addWindowListener(new WindowEventHandler()); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setSize(1060, 708); setVisible(true); } // 6.Creates an internal frame and adds it to the desktop pane. // Takes care of displaying frames with overlap offsets when called // multiple times. public void createInternalFrame() { // 7.Use a suitable internal frame constructor. JInternalFrame iFrame = new JInternalFrame("Internal Frame - " + frameCount, false, false, false, false); iFrame.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); ((BasicInternalFrameUI) iFrame.getUI()).setNorthPane(null); // 8.Set the location and size, and add it to the desktop pane. iFrame.setLocation(xOffSet * frameCount, yOffSet * frameCount); frameCount++; iFrame.setSize(800, 150); iFrame.setVisible(true); desktop.add(iFrame); // 9.Let the frame be selected. try { iFrame.setSelected(true); } catch (java.beans.PropertyVetoException e) { System.out.println("Exception while selecting an internal frame"); } } // 10.The button(action) listener. class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { createInternalFrame(); } } // 11.The listener class to handle closing of the frame. class WindowEventHandler extends WindowAdapter { public void windowClosing(WindowEvent evt) { System.exit(0); } } // 12.The main method. public static void main(String[] args) { String lookAndFeel = UIManager.getSystemLookAndFeelClassName(); try { UIManager.setLookAndFeel(lookAndFeel); } catch (Exception e) { e.printStackTrace(); } TJInternalFrame frame = new TJInternalFrame(); } }
JDesktopPane的继承类JDesktop
package test; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JDesktop extends JDesktopPane { public void paint(Graphics g) { super.paint(g); Dimension d = preferredSizeOfAllFrames(); this.setPreferredSize(d); this.revalidate(); } /** * @return 返回最佳desktop尺寸.. */ public Dimension preferredSizeOfAllFrames() { JInternalFrame [] array = getAllFrames(); int maxX = 0; int maxY = 0; for (int i = 0; i < array.length; i++) { if ( array[ i ].isVisible() ) { int cx; cx = array[i].getX(); int x = cx + array[i].getWidth(); if (x > maxX) maxX = x; int cy; cy = array[i].getY(); int y = cy + array[i].getHeight(); if (y > maxY) maxY = y; } } return new Dimension(maxX, maxY); } }
发表评论
-
ubuntu jdk
2013-07-17 14:14 1425This is only a preview; cha ... -
Ubuntu 中安装 Eclipse
2013-07-17 13:44 1116b.Then righ-click t ... -
java sdk eclipse ubuntu
2013-06-28 23:50 868sudo rm /var/lib/dpkg/info/or ... -
ubuntu eclipse
2012-11-05 09:33 861ubuntu 12.04 eclipse 安装 ... -
ubuntu jdk java
2012-11-05 09:12 891第一步,下载jdk-7u4-linux-i586.tar ... -
jogl 拒绝访问Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError:
2012-08-29 11:15 1372Exception in thread "AWT-E ... -
rxtx
2012-07-14 11:39 0Using RXTX From Rxtx T ... -
hibernate mysql 远程连接问题 字符编码
2011-04-07 20:47 1368报错:Illegal mix of collations (l ... -
hibernate search 初始笑话
2011-01-16 11:18 1125安装官方的说明配置hibernate search , 才是 ... -
Hibernate access HQL 日期时间 Date 与oracle时的区别
2011-01-10 21:51 1516由oracle转access后,发现查询某段时间时报错,折腾了 ... -
Java Hibernate access
2011-01-09 20:26 1314现在想把开发完成的程序,弄个简化版,以前是Java Hiber ... -
程序中调用cmd命令时,参数带有空格的解决方法
2010-08-09 20:31 8971比如在程序中调用cmd命令打开一个文件,而文件路径带有 ... -
java 打包(fatjar)发布,制作安装文件(inno setup)
2010-08-09 18:27 2034使用fatjar 打包,新建空文件夹META-INF, 新建 ... -
Java:log4j与 log4j.properties的配置说明
2010-07-29 21:10 992Java:log4j与log4j.properties的配置说 ... -
使用Fat Jar打包后 Uncaught error fetching image:
2010-07-29 19:55 2448一个错误困扰了好多天了, 在Eclipse里运行没有问题,使 ... -
Eclipse 工程复制粘贴后中文乱码问题
2010-06-04 22:53 1221今天遇到一个奇怪的问题,我想把eclipse工程复制一份然后备 ... -
jTextField的字符长度设为固定长度,超长不能输入 和 只能输入数字
2010-03-16 11:09 7861----------------------------- ... -
【原创】swing 按钮点击 调用swt窗口(SWT浏览器)browser
2010-03-11 14:00 3668网上搜索swing 和swt 都是关于两者的区 ... -
将swt窗口居中(屏幕中间)将swing窗口居中
2010-03-11 13:51 2819将swt窗口居中 Dimension dem=T ... -
java swt browser
2010-03-10 16:29 4710package cmsdb.common.tool; i ...
相关推荐
一个滚动窗格,它知道如何将滚动条添加到摆动的JDesktopPane组件。 长期以来,Swing的JDesktopPane一直存在一个已知问题。 如果JInternalFrame离开视口,则不会添加任何滚动条,并且您将失去“到达” ...
滚动条:JScrollBar 滑块:JSlider 进度栏:JProgressBar 格式化字段:JFormattedTextField 口令字段:JPasswordField Spinner:JSpinner 分隔符:JSeparator 文本窗格:JTextPane 编辑器窗格:JEditorPane 树:...
Java 的swing 组件创建父子窗口的例子,使用的结构是JDesktopPane-JInternalFrame。JDesktopPane 相当于一个“父窗口”,可以拥有多个作为“子窗口”的JInternalFrame 对象。如运行截图所示,当选中Option 菜单下的...
Java创建产生关联的主窗体与子窗体,使用的结构是JDesktopPane-JInternalFrame。JDesktopPane 相当于一个“父窗口”,可以拥有多个作为“子窗口”的JInternalFrame 对象。如运行截图所示,当选中Option 菜单下的...
import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing....
JDesktopPane desktop; FileDialog filedialog_save; // 声明文件对话框 JTextField englishtext; JTextArea chinesetext; JButton b1, b2, b3, b4, b5; JLabel label; JMenuBar mbar; JMenu mfile, medit, ...
图书管理系统数据库源代码 //创建工程及设计主界面 public class Main extends JFrame { private static final JDesktopPane { DESKTOP_PANE=new JDesktopPane(); //桌面窗体 } public static void main(String[]...
public void createAndShowGui(JDesktopPane desk) throws SQLException { //Δημιουργία tabed pane και εισαγωγή φορμών με εικόνες WebLookAndFeel.install (); frame = ...
Java 的swing 组件创建父子窗口的例子,使用的结构是JDesktopPane-JInternalFrame。JDesktopPane 相当于一个“父窗口”,可以拥有多个作为“子窗口”的JInternalFrame 对象。如运行截图所示,当选中Option 菜单下的...
摘要:Java源码,窗体界面,分层框架 Java实现分层框体,实现思路是:先创建一个JLayeredPane ... 这个实例中用到了JFrame 窗体框架中的用于放置JDesktopPane 对象的层,使用JFrame 窗体框架中的另外一个特殊的层,专门
需求分析 1. 系统简介 本系统是一个工程... 附录 系统部分源代码 /** * 主窗体 * */ public class SupplySituation extends JFrame { private static final JDesktopPane DESKTOP_PANE = new JDesktopPane(); public s
该模块提供了一个基于 Swing 的桌面,带有... 使用 JDesktopPane 并通过此模块扩展其功能。 MDI 接口是通过 JInternalFrame 实现的,而 SDI 接口总有一天会通过 JFrames 实现。 看一下该模块的API的当前版本,网址为:
JDesktopPane deskpane = new JDesktopPane();//在窗体里建立虚拟桌 JPanel p = new JPanel();//创建一个面板并实例化 public system(){//构造函数 setTitle("订单管理系统");//设置窗体标题 ...
11.6.1 菜单条、菜单和菜单项 414 11.6.2 右键菜单 416 学生提问:为什么即使我没有给多行文本域编写右键菜单,但当我在多行文本域上单击右键时一样会弹出右键菜单? 418 11.7 在AWT中绘图 418 11.7.1 画图的...