本文整理匯總了Java中javax.swing.DropMode類的典型用法代碼示例。如果您正苦於以下問題:Java DropMode類的具體用法?Java DropMode怎麽用?Java DropMode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DropMode類屬於javax.swing包,在下文中一共展示了DropMode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildList
import javax.swing.DropMode; //導入依賴的package包/類
/**
* Creates the process list
*
* @return JComponent
*/
private JComponent buildList() {
list = new JList<>();
list.setCellRenderer(new CellRenderer(list.getCellRenderer()));
list.setTransferHandler(new ProcessTransferHandler());
list.setDragEnabled(true);
list.setDropMode(DropMode.ON_OR_INSERT);
list.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (e.getClickCount() % 2 == 0) {
ProcessInformationPane.showDialog(list.getSelectedValue());
}
}
});
return ScrollFactory.pane(list).create();
}
示例2: PlotConfigurationTree
import javax.swing.DropMode; //導入依賴的package包/類
public PlotConfigurationTree(PlotConfiguration plotConfiguration, DataTable dataTable,
DataTableColumnListTransferHandler aTH) {
super();
expandAll();
// forces the tree to ask the nodes for the correct row heights
// must also be invoked after LaF changes...
setRowHeight(0);
getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
setExpandsSelectedPaths(true);
// DnD support
setDragEnabled(true);
setDropMode(DropMode.INSERT);
// Rendering
setShowsRootHandles(false);
setBackground(Colors.WHITE);
setCellRenderer(new PlotConfigurationTreeCellRenderer(aTH));
putClientProperty("JTree.lineStyle", "Horizontal");
createNewTreeModel(plotConfiguration);
}
示例3: BagTree
import javax.swing.DropMode; //導入依賴的package包/類
/**
* BagTree.
*
* @param bagView BagView
* @param path String
*/
public BagTree(final BagView bagView, final String path) {
super();
this.setShowsRootHandles(true);
basePath = path;
parentNode = new DefaultMutableTreeNode(basePath);
initialize();
initListeners();
final JTextField nameTextField = new JTextField();
bagtreeRowModifier = nameTextField.getFontMetrics(nameTextField.getFont()).getHeight() + 5;
this.setDragEnabled(true);
this.setDropMode(DropMode.ON_OR_INSERT);
this.setTransferHandler(new BagTreeTransferHandler());
this.getSelectionModel().setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
bagView.registerTreeListener(path, this);
}
示例4: interactiveDropOnVisualsTable
import javax.swing.DropMode; //導入依賴的package包/類
/**
* Issue #370-swingx: drop-on not shown correctly.
*
* Check core default renderer as renderer in Table.
*/
public void interactiveDropOnVisualsTable() {
JXTable xTable = new JXTable(new AncientSwingTeam());
installTransferHandler(xTable);
xTable.getColumn(0).setCellRenderer(new DefaultTableCellRenderer());
JTable table = new JTable(new AncientSwingTeam());
installTransferHandler(table);
// xTable.setDropMode(DropMode.USE_SELECTION);
// table.setDropMode(DropMode.USE_SELECTION);
xTable.setDropMode(DropMode.ON_OR_INSERT);
table.setDropMode(DropMode.ON_OR_INSERT);
JXFrame frame = wrapWithScrollingInFrame(xTable, table,
"JXTable (first column core renderer) <-> core table: drop-on appearance");
JTextField textField = new JTextField("drag me over first column....");
textField.setDragEnabled(true);
addStatusComponent(frame, textField);
show(frame);
}
示例5: interactiveDropOnVisualsList
import javax.swing.DropMode; //導入依賴的package包/類
/**
* Issue #370-swingx: drop-on not shown correctly.
*
* Check core default renderer as renderer in Table.
*/
public void interactiveDropOnVisualsList() {
JXList xTable = new JXList(AncientSwingTeam.createNamedColorListModel());
installTransferHandler(xTable);
JList table = new JList(xTable.getModel());
installTransferHandler(table);
// xTable.setDropMode(DropMode.USE_SELECTION);
// table.setDropMode(DropMode.USE_SELECTION);
xTable.setDropMode(DropMode.ON_OR_INSERT);
table.setDropMode(DropMode.ON_OR_INSERT);
JXFrame frame = wrapWithScrollingInFrame(xTable, table,
"JXList <-> core list: drop-on appearance");
JTextField textField = new JTextField("drag me over first column....");
textField.setDragEnabled(true);
addStatusComponent(frame, textField);
show(frame);
}
示例6: interactiveDropOnVisualsTree
import javax.swing.DropMode; //導入依賴的package包/類
/**
* Issue #370-swingx: drop-on not shown correctly.
*
* Check core default renderer as renderer in Table.
*/
public void interactiveDropOnVisualsTree() {
JXTree xTable = new JXTree(AncientSwingTeam.createNamedColorTreeModel());
installTransferHandler(xTable);
xTable.setCellRenderer(new DefaultTreeRenderer());
JTree table = new JTree(xTable.getModel());
installTransferHandler(table);
// xTable.setDropMode(DropMode.USE_SELECTION);
// table.setDropMode(DropMode.USE_SELECTION);
xTable.setDropMode(DropMode.ON_OR_INSERT);
table.setDropMode(DropMode.ON_OR_INSERT);
JXFrame frame = wrapWithScrollingInFrame(xTable, table,
"JXTree <-> core tree: drop-on appearance");
JTextField textField = new JTextField("drag me over first column....");
textField.setDragEnabled(true);
addStatusComponent(frame, textField);
show(frame);
}
示例7: ExtTextTable
import javax.swing.DropMode; //導入依賴的package包/類
/**
* @param tableModel
*/
public ExtTextTable() {
super(new ExtTestModel());
setSearchEnabled(true);
setDragEnabled(true);
setDropMode(DropMode.ON);
final DragDropHelper ddh = new DragDropHelper();
this.setTransferHandler(ddh);
addRowHighlighter(new SelectionHighlighter(null, new Color(10, 10, 10, 40)));
// getModel().addExtComponentRowHighlighter(new ExtComponentRowHighlighter<TextObject>(Color.BLACK,Color.RED,null) {
//
// @Override
// public boolean accept(ExtColumn<TextObject> column, TextObject value, boolean selected, boolean focus, int row) {
// // TODO Auto-generated method stub
// return selected;
// }
// });
// this.setShowHorizontalLines(false);
setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
}
示例8: init
import javax.swing.DropMode; //導入依賴的package包/類
/**
* Initializer
*/
public void init() {
super.init();
firstClickStrategy = new BlinkingStrategy(this,
MainFrame.METRONOM_COLOR_FIRST_CLICK,
MainFrame.METRONOM_BLINK_RATE, 1);
otherClickStrategy = new BlinkingStrategy(this,
MainFrame.METRONOM_COLOR_OTHER_CLICK,
MainFrame.METRONOM_BLINK_RATE, 1);
setName(NAME);
addMouseListener(doubleClickListener);
setBlinkingStrategy(otherClickStrategy);
setFont(new Font(FONT_FAMILY, Font.BOLD, FONT_SIZE));
setCache(getSelectionBackground());
setDropMode(DropMode.INSERT);
setTransferHandler(transferHandler);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
addListSelectionListener(selectionHandler);
DragSource fileListDragSource = new DragSource();
fileListDragSource.createDefaultDragGestureRecognizer(this,
DnDConstants.ACTION_MOVE, itemListDragGestureListener);
}
示例9: PvExplorer
import javax.swing.DropMode; //導入依賴的package包/類
public PvExplorer(ProcessVar pv)
{
setDividerSize(2);
setPreferredSize(new Dimension(640, 480));
pvTree = new JTree(new PvTreeNode(pv));
pvTree.getSelectionModel().addTreeSelectionListener(this);
pvTree.setDragEnabled(true);
pvTree.setDropMode(DropMode.ON_OR_INSERT);
pvTree.setTransferHandler(xferHdlr);
pvTable = new PvTable(pv);
pvTable.setDragEnabled(true);
pvTable.setDropMode(DropMode.ON_OR_INSERT);
pvTable.addMouseListener(tblMouseLstnr);
pvTable.setTransferHandler(xferHdlr);
JScrollPane spPvTree = new JScrollPane(pvTree);
add(spPvTree, JSplitPane.LEFT);
JScrollPane spPvTable = new JScrollPane(pvTable);
add(spPvTable, JSplitPane.RIGHT);
}
示例10: setCenterPane
import javax.swing.DropMode; //導入依賴的package包/類
/**
* Creates the center pane that shows the pictures thumbnail list.
*/
private void setCenterPane() {
DefaultListModel<PhotManImage> dlm = new DefaultListModel<>();
m_thumbnails = new JList<>(dlm);
m_thumbnails.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
m_thumbnails.setTransferHandler(new PhotManListItemTransferHandler());
m_thumbnails.setDropMode(DropMode.INSERT);
m_thumbnails.setDragEnabled(true);
m_thumbnails.setLayoutOrientation(JList.HORIZONTAL_WRAP);
m_thumbnails.setVisibleRowCount(0);
m_thumbnails.setFixedCellWidth(m_options.getThumbnailSize()+10);
m_thumbnails.setFixedCellHeight(m_options.getThumbnailSize()+30);
m_thumbnails.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
m_thumbnails.setCellRenderer(new PhotManListCellRenderer());
JScrollPane imagesScroll = new JScrollPane(m_thumbnails);
m_contentPane.add(imagesScroll,BorderLayout.CENTER);
}
示例11: OliviaTree
import javax.swing.DropMode; //導入依賴的package包/類
public OliviaTree() {
//設定
this.setFocusable(true);
//複數選択可能にする
this.getSelectionModel().setSelectionMode(
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
//ノード名を編集可能にする
this.setEditable(true);
this.setCellEditor(new OliviaCellEditor(this, new OliviaCellEditField(this)));
//ドラッグドロップを可能にする
this.setDragEnabled(true);
this.setDropMode(DropMode.ON_OR_INSERT);
//モデル側のプロジェクトを反映
this.model = Olivia.getView().getComponents().getTreeArea();
initialize(Olivia.getProjects().getCurrentProject());
}
示例12: PlotConfigurationTree
import javax.swing.DropMode; //導入依賴的package包/類
public PlotConfigurationTree(PlotConfiguration plotConfiguration, DataTable dataTable, DataTableColumnListTransferHandler aTH) {
super();
expandAll();
// forces the tree to ask the nodes for the correct row heights
// must also be invoked after LaF changes...
setRowHeight(0);
getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
setExpandsSelectedPaths(true);
// DnD support
setDragEnabled(true);
setDropMode(DropMode.INSERT);
// Rendering
setShowsRootHandles(false);
setCellRenderer(new PlotConfigurationTreeCellRenderer(aTH));
putClientProperty("JTree.lineStyle", "Horizontal");
createNewTreeModel(plotConfiguration);
}
示例13: setDropMode
import javax.swing.DropMode; //導入依賴的package包/類
public void setDropMode(DropMode dropMode) {
if (dropMode == null) {
dropModeSet = false;
updateDropMode();
} else {
switch (dropMode) {
default:
throw new IllegalArgumentException("Unsupported DropMode: " + dropMode);
case ON:
case INSERT:
case INSERT_ROWS:
case INSERT_COLS:
case ON_OR_INSERT:
case ON_OR_INSERT_ROWS:
case ON_OR_INSERT_COLS:
}
dropModeSet = true;
table.setDropMode(dropMode);
}
}
示例14: ChecklistTreePanel
import javax.swing.DropMode; //導入依賴的package包/類
public ChecklistTreePanel() {
super( new BorderLayout() );
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode( "Root", true );
treeModel = new DefaultTreeModel( rootNode, true );
tree = new JTree( treeModel );
tree.setCellRenderer( new DefaultTreeCellRenderer() );
tree.setRootVisible( false );
tree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION );
checklistManager = new ChecklistTreeManager( tree, true, null );
JScrollPane scrollPane = new JScrollPane( tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
this.add( scrollPane, BorderLayout.CENTER );
tree.setTransferHandler( new TreeTransferHandler( tree ) );
tree.setDropMode( DropMode.ON_OR_INSERT ); // Drop between rows, or onto groups.
tree.setDragEnabled( true );
}
示例15: JDragDropList
import javax.swing.DropMode; //導入依賴的package包/類
public JDragDropList(StandardListModel<T> model) {
super(model);
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
setDragEnabled(true);
setDropMode(DropMode.INSERT);
setTransferHandler(new JDDLTransferHandler());
}