public class TankPanel extends JPanel implements ITankPanel, ActionListener, MouseListener
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
private ButtonGroup |
buttonGroup
The button group for the selection in the menu.
|
private DropTarget |
dropTarget
Support for drag and drop of files.
|
private TankPanelDropEventHandler |
dropTargetHandler |
private JMenuBar |
jMenuBar |
private int |
keepNumber |
private static org.apache.log4j.Logger |
logger |
private JMenuItem |
menuItemDelete |
private JMenuItem |
mntmMergeSelectedItems |
private DefaultListModel |
model
Model where the items are stored.
|
private JMenu |
optionMenu |
private static long |
serialVersionUID
The UID for serialization.
|
private JPanel |
tankContentPanel |
private JList |
tankList
The tank list.
|
private ScrollablePanel |
tankListContainer |
private JRadioButtonMenuItem |
tankOpt1 |
private JRadioButtonMenuItem |
tankOpt2 |
private JRadioButtonMenuItem |
tankOpt3 |
private JRadioButtonMenuItem |
tankOpt4 |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTKEEP_1, KEEP_10, KEEP_50, KEEP_ALLABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
TankPanel()
This method initializes Tank, default orientation is horizontal.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent e) |
void |
addNotify()
Wire the notifications for the drop target listener.
|
private void |
confirmDeletionOfItem(int index) |
private void |
confirmDeletionOfMoreItems() |
void |
createAndShowGUI()
This method creates and shows the GUI
|
private JMenuItem |
createJMenuItemCustomDelete()
This method initializes jMenuItemDelete
|
private JRadioButtonMenuItem |
createKeep10Images()
This method initializes tankOpt3
|
private JRadioButtonMenuItem |
createKeep1Image()
This method initializes tankOpt2
|
private JRadioButtonMenuItem |
createKeep50Images()
This method initializes tankOpt4
|
private JRadioButtonMenuItem |
createKeepAllImages()
This method initializes tankOpt1
|
private JMenu |
createOptionMenu()
This method initializes optionMenu
|
private JMenuBar |
createOptionsMenuBar()
This method initializes MenuBar
|
private JPanel |
createTankContentPanel()
This method initializes tankContentPanel.
|
void |
deleteAllIndices()
This method deletes all images in the tank by calling
deleteSelectedIndices(int[]). |
private void |
deleteSelectedIndex(int index)
This method deletes images of the selected index.
|
private void |
deleteSelectedIndexFromTank(int idx)
This method deletes the selected images from the tank
|
void |
deleteSelectedIndices(int[] indices)
This method deletes images of selected indices by calling
deleteSelectedIndex(int idx).
|
int |
getKeepNumber()
This method gets the flag items to keep.
|
private JMenuItem |
getMntmMergeSelectedItems() |
DefaultListModel |
getModel() |
JList |
getTankList()
This method creates the TankList.
|
protected DropTarget |
getTankPanelDropTarget() |
protected TankPanelDropEventHandler |
getTankPanelDropTargetHandler() |
protected void |
handleExportAction() |
private void |
handleListKeyReleased(KeyEvent evt)
This method listens, if the "Delete"-key is released in the tank list.
|
void |
mouseClicked(MouseEvent e)
A double left mouse click loads the items from the tank index to the
selected manager list (left or right).
|
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
removeNotify()
Remove notifications for the drop target listener.
|
void |
setKeepNumber(int arg)
This method sets the flag how many images to keep.
|
void |
setModel(DefaultListModel arg) |
private void |
showDeleteConfirmation(MouseEvent e)
This method shows a notification to the user whether he/she wants to
delete the selected indices from the tank list.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprivate static final long serialVersionUID
private static final org.apache.log4j.Logger logger
private int keepNumber
private JPanel tankContentPanel
private ScrollablePanel tankListContainer
private JMenuBar jMenuBar
private JMenu optionMenu
private JRadioButtonMenuItem tankOpt1
private JRadioButtonMenuItem tankOpt2
private JRadioButtonMenuItem tankOpt3
private JRadioButtonMenuItem tankOpt4
private JMenuItem menuItemDelete
private DropTarget dropTarget
private TankPanelDropEventHandler dropTargetHandler
private JList tankList
private DefaultListModel model
private final ButtonGroup buttonGroup
private JMenuItem mntmMergeSelectedItems
public TankPanel()
public void createAndShowGUI()
public int getKeepNumber()
getKeepNumber in interface ITankPanelpublic void setKeepNumber(int arg)
setKeepNumber in interface ITankPanelarg - private JPanel createTankContentPanel()
public DefaultListModel getModel()
getModel in interface ITankPanelpublic void setModel(DefaultListModel arg)
setModel in interface ITankPanelprivate JMenuBar createOptionsMenuBar()
private JMenu createOptionMenu()
private JRadioButtonMenuItem createKeepAllImages()
private JRadioButtonMenuItem createKeep1Image()
private JRadioButtonMenuItem createKeep10Images()
private JRadioButtonMenuItem createKeep50Images()
private JMenuItem createJMenuItemCustomDelete()
public JList getTankList()
getTankList in interface ITankPanelprivate void handleListKeyReleased(KeyEvent evt)
evt - - the key eventpublic void deleteAllIndices()
deleteSelectedIndices(int[]).deleteAllIndices in interface ITankPanelpublic void deleteSelectedIndices(int[] indices)
indices - - int[] of the selected indicesprivate void deleteSelectedIndex(int index)
index - - int, the selected indexprivate void deleteSelectedIndexFromTank(int idx)
idx - - the index to be removedpublic void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenerpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerprivate void showDeleteConfirmation(MouseEvent e)
null,
if you don't want to determine the mouse position.e - - the mouse event for calculating the mouse positionprivate void confirmDeletionOfItem(int index)
private void confirmDeletionOfMoreItems()
private JMenuItem getMntmMergeSelectedItems()
protected void handleExportAction()
protected DropTarget getTankPanelDropTarget()
protected TankPanelDropEventHandler getTankPanelDropTargetHandler()
public void addNotify()
addNotify in class JComponentpublic void removeNotify()
removeNotify in class JComponentCopyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.