求教:如何创建类似jbuilder风格的窗格

iuchy 2006-12-27 03:03:41
求教:在编写的应用程序中如何创建出有jbuilder风格的窗格,采用swing是否可以,有没有相应的控件(免费的)可以使用,或者能否提供实现的思路?最好能有代码举例。
谢谢各位高人!刚看java没多久:)
...全文
167 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
iuchy 2006-12-29
  • 打赏
  • 举报
回复
揭帖。
谢谢carlkkx() ,找的就是这个。
carlkkx 2006-12-28
  • 打赏
  • 举报
回复
VLDocking
iuchy 2006-12-28
  • 打赏
  • 举报
回复
我需要实现的是像 JIDE Docking Framework 这样的一种控件,不知有没有免费的...
iuchy 2006-12-27
  • 打赏
  • 举报
回复
谢谢lixiaoxue85(蛮野蛮)。
不过我不希望采用拆分窗口的方式实现,这种方式不能随意拖动窗体。

谢谢chenweionline(键盘上的舞者)。
我去找资料看看,不多你有没有相应的资料或源码可以参考?

继续讨论...
lixiaoxue85 2006-12-27
  • 打赏
  • 举报
回复
JSplitPane
/**
@version 1.02 2004-08-22
@author Cay Horstmann
*/

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;

/**
This program demonstrates the split pane component
organizer.
*/
public class SplitPaneTest
{
public static void main(String[] args)
{
JFrame frame = new SplitPaneFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}

/**
This frame consists of two nested split panes to demonstrate
planet images and data.
*/
class SplitPaneFrame extends JFrame
{
public SplitPaneFrame()
{
setTitle("SplitPaneTest");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

// set up components for planet names, images, descriptions

final JList planetList = new JList(planets);
final JLabel planetImage = new JLabel();
final JTextArea planetDescription = new JTextArea();

planetList.addListSelectionListener(new
ListSelectionListener()
{
public void valueChanged(ListSelectionEvent event)
{
Planet value = (Planet) planetList.getSelectedValue();

// update image and description

planetImage.setIcon(value.getImage());
planetDescription.setText(value.getDescription());
}
});

// set up split panes

JSplitPane innerPane
= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, planetList, planetImage);

innerPane.setContinuousLayout(true);
innerPane.setOneTouchExpandable(true);

JSplitPane outerPane
= new JSplitPane(JSplitPane.VERTICAL_SPLIT, innerPane, planetDescription);

add(outerPane, BorderLayout.CENTER);
}

private Planet[] planets =
{
new Planet("Mercury", 2440, 0),
new Planet("Venus", 6052, 0),
new Planet("Earth", 6378, 1),
new Planet("Mars", 3397, 2),
new Planet("Jupiter", 71492, 16),
new Planet("Saturn", 60268, 18),
new Planet("Uranus", 25559, 17),
new Planet("Neptune", 24766, 8),
new Planet("Pluto", 1137, 1),
};
private static final int DEFAULT_WIDTH = 300;
private static final int DEFAULT_HEIGHT = 300;
}

/**
Describes a planet.
*/
class Planet
{
/**
Constructs a planet.
@param n the planet name
@param r the planet radius
@param m the number of moons
*/
public Planet(String n, double r, int m)
{
name = n;
radius = r;
moons = m;
image = new ImageIcon(name + ".gif");
}

public String toString()
{
return name;
}

/**
Gets a description of the planet.
@return the description
*/
public String getDescription()
{
return "Radius: " + radius + "\nMoons: " + moons + "\n";
}

/**
Gets an image of the planet.
@return the image
*/
public ImageIcon getImage()
{
return image;
}

private String name;
private double radius;
private int moons;
private ImageIcon image;
}
chenweionline 2006-12-27
  • 打赏
  • 举报
回复
可以研究一下 Drag and Drop(DnD)
我前段时间用DnD做过类似的,最近比较忙,还有一些bug没有解决。
据说Java6里又对DnD做了加强,没有研究,具体哪些还不太清楚。
iuchy 2006-12-27
  • 打赏
  • 举报
回复
我只是想创建类似的窗格,然后在其上添加自己的控件,然后可以随意的拖动这个窗格到应用程序上下左右的位置,不想用分割窗口的方式实现这些功能。
求教...
jayfantsy 2006-12-27
  • 打赏
  • 举报
回复
jbuilder风格的窗格
怎样的啊..没看出有什么特别..

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧