gpt4 book ai didi

具有精美拖放功能的 Java 应用程序

转载 作者:行者123 更新时间:2023-11-29 10:05:13 26 4
gpt4 key购买 nike

是否有任何框架或工具可以开发精美的 Java 应用程序 - 具有良好拖放功能的用户界面?

例如来自 Mac OS 的这个: http://appzapper.com/

enter image description here

它不需要具有 Mac 操作系统的外观。

最佳答案

参见 Introduction to DnD在教程中开发一些有效的代码。


Please see the screenshot on the first post to see what is a specification of nice.

The only custom part is the dashed border of the downward pointing arrow, and the text below it. You might use an icon (for the arrow/border) in a JLabel with HTML formatting for the text, to achieve that.

例如

Icon with HTML formatted text in label

package test.t100.t006;

import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class DrawLabel {

public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable(){
public void run() {
// substitute for downward pointing arrow with dashed border
Object obj = UIManager.getDefaults()
.get("OptionPane.warningIcon");
if (obj!=null && obj instanceof Icon) {
Icon icon = (Icon)obj;
String text = "<html><body>Drag <em><b>Stuff</b></em> Here";
JLabel l = new JLabel(
text, icon, SwingConstants.HORIZONTAL);
l.setVerticalTextPosition(SwingConstants.BOTTOM);
l.setHorizontalTextPosition(SwingConstants.CENTER);
JOptionPane.showMessageDialog(
null, l);
}
}
});
}
}

关于具有精美拖放功能的 Java 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10751001/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com