本文整理汇总了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());
}