久久久久久久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在线播放精品91 | 成人毛片一区二区三区 | 国产亚洲精品久久久久动 | 九七午夜剧场福利写真 | 久久免费精品 | 天天综合久久 | 色av一区| 亚洲综合字幕 | 国产精品女人久久久 | 国产三区精品 | a级毛片基地 | 国产日韩欧美一区二区 | 91精品在线播放 | 欧美一级淫片免费视频黄 | 免费a在线 | 国产真实精品久久二三区 | 欧美性大战久久久久久久蜜臀 | 欧美激情精品久久久久久 | 欧美成人二区 | 精品1区2区 | 久久精品一区二区三区四区 | 亚洲资源站 | 国产精品成人在线观看 | 中文字幕在线播放第一页 | 毛片一级电影 | 久久亚洲国产 | 精品1区2区| 久久99网| 亚洲午夜视频在线观看 | 日韩色视频 | 色婷婷综合久久久中字幕精品久久 | 免费观看色 | 久久精品国产久精国产 | 日韩 欧美 二区 | 天啪| 影视一区| 日韩精品人成在线播放 | 国产综合在线视频 | a视频在线 | 91精品一区 |