我在Eclipse Helios中使用Windows Builder Pro.在NetBeans中,我知道如何添加SwingX调色板.如何在Windows Builder中添加SwingX调色板?
我一直在看Apache Pivot,我想知道它是否已经准备好用作Swing替代品(考虑到Swing和SwingX开发变得如此缓慢 - 几乎处于休眠状态).
有人试过吗?您是否知道RAD与Apache Pivot的任何拖放式GUI设计器?
谢谢.
我正在使用JTable.我有一个Date列,当我点击一个单元格时,我需要在其中显示一个JXDatePicker,以便我可以从中选择一个日期.
有人能告诉我怎么做吗?
谢谢!等待一个答复..
我正在使用netbeans 7.2并且想要安装swingX.我已经安装了swingX 1.6.2但它无法正常工作.感谢您.
这必须主要是一个新手Maven问题.
由于SwingX迁移到Kenai,整个网站都有警告,许多链接都被破坏了......所以这是我最好的尝试.
但是,此源jar不包含POM.XML.
所以,我从同一个链接下载了swingx-all-1.6.4.jar,将其重命名为.zip,充气.它确实包含META-INF\maven\org.swinglabs.swingx\swingx-all\POM.XML:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>swingx-project</artifactId>
<groupId>org.swinglabs.swingx</groupId>
<version>1.6.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>swingx-all</artifactId>
<packaging>jar</packaging>
<name>SwingX Complete</name>
<description>A Maven project to aggregate all modules into a single artifact.</description>
<properties>
<project.generatedDependencies>${project.generatedSourcesDirectoy}/dependencies</project.generatedDependencies>
</properties>
<!-- make the dependent swingx modules optional, since we're aggregating -->
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swingx-graphics</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swingx-core</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swingx-mavensupport</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
<profiles> …Run Code Online (Sandbox Code Playgroud) 我JDatePicker在我的应用程序中得到了工作,但希望将日期格式化为YYYY_MM_DD
当前日期的格式是默认值.Wed Jul 08 15:17:01 ADT 2015
在本指南中,有一个类格式化日期,如下所示.
package net.codejava.swing;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.swing.JFormattedTextField.AbstractFormatter;
public class DateLabelFormatter extends AbstractFormatter {
private String datePattern = "yyyy-MM-dd";
private SimpleDateFormat dateFormatter = new SimpleDateFormat(datePattern);
@Override
public Object stringToValue(String text) throws ParseException {
return dateFormatter.parseObject(text);
}
@Override
public String valueToString(Object value) throws ParseException {
if (value != null) {
Calendar cal = (Calendar) value;
return dateFormatter.format(cal.getTime());
}
return "";
}
}
Run Code Online (Sandbox Code Playgroud)
所以我将类添加到我的包中,Swing应用程序具有适当的构造函数
JDatePickerImpl datePicker …Run Code Online (Sandbox Code Playgroud) 我编写了以下示例代码:
import org.jdesktop.swingx.*;
import javax.swing.*;
import java.awt.*;
public class TaskPaneExample{
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new TaskPaneExample();
}});
}
public TaskPaneExample() {
JFrame frame = new JFrame("TaskPane Example 1");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(doInit(), BorderLayout.CENTER);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
private Component doInit() {
JXTaskPaneContainer taskpanecontainer = new JXTaskPaneContainer();
taskpanecontainer.setLayout(new VerticalLayout(2));
final JXTaskPane taskpane1 = new JXTaskPane(){
public void setCollapsed(boolean w){
super.setCollapsed(w);
}};
taskpane1.setTitle("First TaskPane");
JPanel panel1 = new JPanel();
panel1.setBackground(Color.red);
panel1.setSize(100,100);
taskpane1.add(panel1);
taskpanecontainer.add(taskpane1);
JXTaskPane taskpane2 …Run Code Online (Sandbox Code Playgroud) 所以我的文字比他们占用的一些组件要长一些.我已经为大多数问题提出了合理的解决方案,但我不知道如何处理组合框中的非常长的文本项.如果用户看不到文本,他就无法做出正确的决定 - 特别是如果文本的第一部分匹配.请参阅下面的我的SSCCE.
我使用JScrollpane来解决JTextfield中的长文本问题,并且我使用工具提示来解析JXhyperlink字段中的长文本.另外,我为组合框提供了一个工具提示,它可以在选择后显示一个长项,但理想情况下我想在用户做出选择之前将该选项提供给用户.这个代码示例使用Netbeans的GUI设计器(非常适合RAD目的)放在一起,布局是GUI设计者使用的GroupLayout.
package longtextsexample;
import javax.swing.JFileChooser;
public class MainFrame extends javax.swing.JFrame {
/**
* Creates new form MainFrame
*/
public MainFrame() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
*/
@SuppressWarnings("unchecked")
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTextField1 = new javax.swing.JTextField();
jComboBox1 = new javax.swing.JComboBox();
jXHyperlink1 = new org.jdesktop.swingx.JXHyperlink();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jScrollPane1.setViewportView(jTextField1);
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 222222222222222222222222", …Run Code Online (Sandbox Code Playgroud) 我已经更新了这个问题,以便更准确地描述我的问题的原因,并且包含了一个比我最初使用的更简单的例子.
我在下面添加了一个简单的示例来说明我遇到的性能问题.当我使用普通的ArrayList支持我的JXTable时,它的表现相当不错.但是,如果我为EventList切换ArrayList并使用EventTableModel构建表,则排序要慢得多(在这种情况下慢约10倍).
如果使用Maven或Gradle,这里是我正在使用的工件坐标.
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "SortPerfMain"
dependencies {
compile "net.java.dev.glazedlists:glazedlists_java15:1.8.0"
compile "org.swinglabs.swingx:swingx-core:1.6.4"
}
Run Code Online (Sandbox Code Playgroud)
这是一个例子.我试图使用EventList的唯一原因是因为我想要一个我可以在TableModel之外修改并且发生必要通知的数据结构.
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.gui.TableFormat;
import ca.odell.glazedlists.swing.EventTableModel;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.renderer.*;
import org.jdesktop.swingx.table.TableColumnExt;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
/* This class creates a JFrame with two JXTables displayed side by side. Both
* tables have a single column that holds Item objects. Each Item has one …Run Code Online (Sandbox Code Playgroud) 我正在为我的大学项目开发一个软件.我正在使用java来开发我的桌面应用程序.为此,我想添加这样的组件:http://www.mediafire.com/view/?6y1183p8u6phwzg
我想添加一个类似于下面框架左侧的组件.它是一个可调整大小的组件,包含标题和子菜单.我们还可以在Windows XP OS的左侧看到这些组件.我努力开发这个组件,只能制作一个可调整大小的组件,但它不会减少它们之间的空白空间.我将把我的代码放在下面并对我的应用程序进行抽样设计.我会觉得很感激,如果任何人可以给我一个解决方案,使我的组件工作,我希望还是给一个很好的解决方案,使这个component.Thank你了.:)
http://www.mediafire.com/view/?c9b8jwp4c558zae
private void lbl1MousePressed(java.awt.event.MouseEvent evt) {
if (!(jpnTop.getSize().equals(lbl1.getSize()))) {
try {
Thread.sleep(100);
jpnTop.setSize(lbl1.getSize());
} catch (InterruptedException ex) {
}
} else {
try {
Thread.sleep(100);
jpnTop.setSize(169, 162);
} catch (InterruptedException ex) {
}
}
}
private void lbl2MousePressed(java.awt.event.MouseEvent evt) {
if (!(jpnLow.getSize().equals(lbl2.getSize()))) {
try {
Thread.sleep(100);
jpnLow.setSize(lbl2.getSize());
} catch (InterruptedException ex) {
}
} else {
try {
Thread.sleep(100);
jpnLow.setSize(169, 162);
} catch (InterruptedException ex) {
}
}
}
Run Code Online (Sandbox Code Playgroud)
Ps:由于这个网站的限制,我无法上传我的图片,请您使用上面的medeafire链接看到它们.非常感谢.
java ×10
swingx ×10
swing ×9
jxtaskpane ×2
apache-pivot ×1
datepicker ×1
eclipse ×1
glazedlists ×1
jcombobox ×1
jtable ×1
jxtable ×1
maven ×1
netbeans ×1
text ×1