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

在 Mac OS X 上使用 JTable 進(jìn)行拖放

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

問題描述

限時(shí)送ChatGPT賬號(hào)..

我在 Mac 上遇到了 DnD 和 JTable 的問題.如果您啟動(dòng)以下程序并在表格中單擊(快速),有時(shí)會(huì)選擇某些內(nèi)容,有時(shí)會(huì)在一段時(shí)間后執(zhí)行 DnD 應(yīng)用程序崩潰或至少 DnD 不會(huì)有可能了.我在 2 臺(tái) Mac 上對(duì)其進(jìn)行了測試.

Java 版本:1.6.0_35Mac OS X:10.6.8

有人可以確認(rèn)嗎?有什么解決方法嗎?

包tablednd;導(dǎo)入 javax.swing.JFrame;導(dǎo)入 javax.swing.JTable;導(dǎo)入 javax.swing.SwingUtilities;公共類 TableDnD {公共靜態(tài)無效主要(字符串[]參數(shù)){SwingUtilities.invokeLater(new Runnable() {@覆蓋公共無效運(yùn)行(){對(duì)象[][] 數(shù)據(jù) = {{瑪麗",坎皮奧內(nèi)",滑雪板",新整數(shù)(5),新布爾(假)},{艾莉森",Huml",劃船",新整數(shù)(3),新布爾(真)},{"Kathy", "Walrath", "Chasing toddlers", new Integer(2), new Boolean(false)},{"Mark", "Andrews", "速讀", new Integer(20), new Boolean(true)},{"Angela", "Lih", "教學(xué)高中", 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);}});}}

解決方案

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

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

將拖動(dòng)的行放到另一個(gè)應(yīng)用程序上可以按預(yù)期工作.

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

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.

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

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

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時(shí)間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
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 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 亚洲欧美一区二区三区国产精品 | 久久久精彩视频 | 一级a爱片久久毛片 | 在线第一页 | 一区二区在线 | 91网站在线观看视频 | 免费视频一区二区三区在线观看 | 国产精品美女久久久久久久网站 | 在线观看 亚洲 | 欧美午夜精品理论片a级按摩 | 欧美精品一区二区三区四区五区 | 欧美人人 | 97精品国产 | 精品一级| 国产一区欧美 | 久久成人综合 | 国产91视频免费 | 亚洲一区二区三区四区五区中文 | 在线观看亚洲专区 | 午夜爽爽爽男女免费观看影院 | 久热久热 | 亚洲 欧美 综合 | 日本一区二区三区在线观看 | 久久99精品久久久久 | 日韩成人影院 | 九九久久精品视频 | 亚洲欧美中文日韩在线v日本 | 国产精品久久久久久久久免费樱桃 | 日韩激情网 | 在线观看中文字幕亚洲 | 青青草免费在线视频 | 一级片免费视频 | 国产一区二区精品自拍 | 伊人二区 | 久草视频在线看 | 91毛片在线看 | 黄色亚洲网站 | 亚洲日本视频 | 天天干天天操天天爽 | 91精品国产91久久久久久 | 成人精品鲁一区一区二区 |