Created
February 8, 2020 03:32
-
-
Save Aroueterra/e71a243605fe060a1c9a8205bb9fc613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void simulateClipBoard() { | |
javax.swing.table.DefaultTableModel model = (javax.swing.table.DefaultTableModel) table_RenamingInputOutput.getModel(); | |
int np = model.findColumn("[Name]"); | |
if (table_RenamingInputOutput.getSelectedColumn() == np) { | |
try { | |
String data = (String) Toolkit.getDefaultToolkit() | |
.getSystemClipboard().getData(DataFlavor.stringFlavor); | |
String[] values = data.split("[\\r\\n]+"); | |
if (values.length > 1) { | |
for (int i = table_RenamingInputOutput.getSelectedRow(), j = 0; i <= table_RenamingInputOutput.getRowCount() - 1 && j <= values.length-1; i++, j++) { | |
if (values[j] != null) { | |
table_RenamingInputOutput.setValueAt(values[j], i, np); | |
} | |
} | |
} | |
} catch (UnsupportedFlavorException ex) { | |
Logger.getLogger(Window.class.getName()).log(Level.SEVERE, null, ex); | |
} catch (IOException ex) { | |
Logger.getLogger(Window.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment