久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Mac OS X 上使用 JTable 進行拖放

Drag and Drop with JTable on Mac OS X(在 Mac OS X 上使用 JTable 進行拖放)
本文介紹了在 Mac OS X 上使用 JTable 進行拖放的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我在 Mac 上遇到了 DnD 和 JTable 的問題.如果您啟動以下程序并在表格中單擊(快速),有時會選擇某些內容,有時會在一段時間后執行 DnD 應用程序崩潰或至少 DnD 不會有可能了.我在 2 臺 Mac 上對其進行了測試.

Java 版本:1.6.0_35Mac OS X:10.6.8

有人可以確認嗎?有什么解決方法嗎?

包tablednd;導入 javax.swing.JFrame;導入 javax.swing.JTable;導入 javax.swing.SwingUtilities;公共類 TableDnD {公共靜態無效主要(字符串[]參數){SwingUtilities.invokeLater(new Runnable() {@覆蓋公共無效運行(){對象[][] 數據 = {{瑪麗",坎皮奧內",滑雪板",新整數(5),新布爾(假)},{艾莉森",Huml",劃船",新整數(3),新布爾(真)},{"Kathy", "Walrath", "Chasing toddlers", new Integer(2), new Boolean(false)},{"Mark", "Andrews", "速讀", new Integer(20), new Boolean(true)},{"Angela", "Lih", "教學高中", new Integer(4), new Boolean(false)}};String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};最終 JTable 表 = new JTable(data, columnNames);JFrame 框架 = 新的 JFrame();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);table.setDragEnabled(true);框架.添加(表);框架.pack();frame.setLocationRelativeTo(null);frame.setVisible(true);}});}}

解決方案

在將拖動的行拖放到表格的其他任何位置時,我(有時)在 Mac OS X 10.5.8 中得到如下所示的錯誤.目標選擇矩形保留在屏幕上,無法進行進一步的拖動操作.我不知道為什么,但我想一個單元格沒有被識別為適合一行的目的地.

<上一頁>2012-10-14 14:14:23.912 java[44061:10b] ***-[NSWindowViewAWT draggingEnded:]:無法識別的選擇器發送到實例 0x1001e71402012-10-14 14:14:23.913 java[44061:10b] ***-[NSWindowViewAWT draggingEnded:]:無法識別的選擇器發送到實例 0x1001e7140

將拖動的行放到另一個應用程序上可以按預期工作.

順便說一句,的解決方案.

i have a problem with DnD and JTable on macs. If you start the following program and click (fast) around in the table, sometimes selecting something, sometimes do DnD after a while the application crashes or at least DnD will not be possible anymore. I tested it on 2 Macs.

Java version: 1.6.0_35 Mac OS X: 10.6.8

Does anyone can confirm this? Any workaround?

package tablednd;

import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.SwingUtilities;

public class TableDnD {
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            Object[][] data = {
                {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
                {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
                {"Kathy", "Walrath", "Chasing toddlers", new Integer(2), new Boolean(false)},
                {"Mark", "Andrews", "Speed reading", new Integer(20), new Boolean(true)},
                {"Angela", "Lih", "Teaching high school", new Integer(4), new Boolean(false)}
            };

            String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};

            final JTable table = new JTable(data, columnNames);
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            table.setDragEnabled(true);
            frame.add(table);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
}

解決方案

When dropping a dragged row anywhere else on the table, I (sometimes) get the errors shown below back as far as Mac OS X 10.5.8. The target selection rectangle remains on the screen, and no further drag operations are possible. I'm not sure why, but I suppose a cell is not recognized as a suitable destination for a row.

2012-10-14 14:14:23.912 java[44061:10b] *** -[NSWindowViewAWT draggingEnded:]:
    unrecognized selector sent to instance 0x1001e7140
2012-10-14 14:14:23.913 java[44061:10b] *** -[NSWindowViewAWT draggingEnded:]:
    unrecognized selector sent to instance 0x1001e7140

Dropping the dragged row on another application works as expected.

As an aside, auto-boxing can simplify the initialization code:

Object[][] data = {
    {"Mary", "Campione", "Snowboarding", 5, false},
    {"Alison", "Huml", "Rowing", 3, true},
    {"Kathy", "Walrath", "Chasing toddlers", 2, false},
    {"Mark", "Andrews", "Speed reading", 20, true},
    {"Angela", "Lih", "Teaching high school", 4, false}
};

Addendum: This image shows the drag in progress; after triggering the anomaly, the gray rectangle remains immobile when the frame is dragged.

As a workaround, there is a solution to disable the grey rectangle altogether.

這篇關于在 Mac OS X 上使用 JTable 進行拖放的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 日韩蜜桃视频 | 91黄色免费看 | 久久黄色精品视频 | 久色视频在线 | 亚洲第一天堂无码专区 | 午夜精品久久久久久久99黑人 | 久久久亚洲精品视频 | 国产精品1区2区3区 男女啪啪高潮无遮挡免费动态 | 国产成在线观看免费视频 | 老司机久久 | 日日摸日日碰夜夜爽亚洲精品蜜乳 | 国产精品一区二区免费看 | 亚洲精品久久久久久久久久久 | 蜜臀网站 | 一区观看| 欧美日一区二区 | 久久精品中文 | 精品久久久一区 | www.99精品| 日韩电影中文字幕 | 国产美女久久 | 国产日韩精品久久 | 成人午夜精品 | 国产成人精品一区二区三区网站观看 | 免费99精品国产自在在线 | 日韩精品免费在线观看 | 欧美性jizz18性欧美 | 久久久久国产一区二区三区不卡 | 国产精品久久久久久久三级 | 国产精品99久久久久久久vr | 亚洲在线免费观看 | 91视频亚洲 | 亚洲免费精品一区 | 91精品国产色综合久久 | 久久精品亚洲精品国产欧美 | 久久精品视频播放 | 国产欧美一区二区三区在线播放 | 九九热精品视频 | 欧美激情久久久 | 精品九九九 | 在线播放国产一区二区三区 |