1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.support.actions;
14
15 import java.awt.event.ActionEvent;
16 import java.awt.event.KeyEvent;
17
18 import javax.swing.AbstractAction;
19 import javax.swing.Action;
20 import javax.swing.JSplitPane;
21 import javax.swing.KeyStroke;
22
23 import com.eviware.soapui.SoapUI;
24
25 /***
26 * Changes the orientation of a JSplitPane
27 *
28 * @author Ole.Matzura
29 */
30
31 public class ChangeSplitPaneOrientationAction extends AbstractAction
32 {
33 private final JSplitPane splitPane;
34
35 public ChangeSplitPaneOrientationAction(JSplitPane splitPane)
36 {
37 super();
38 this.splitPane = splitPane;
39
40 putValue(Action.SMALL_ICON, SoapUI
41 .createImageIcon("/split_request_pane.gif"));
42 putValue(Action.SHORT_DESCRIPTION,
43 "Changes the orientation of the request pane split");
44 putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke( KeyEvent.VK_O, KeyEvent.ALT_MASK ));
45 }
46
47 public void actionPerformed(ActionEvent e)
48 {
49 int orientation = splitPane.getOrientation();
50 splitPane.setOrientation(orientation == JSplitPane.HORIZONTAL_SPLIT ? JSplitPane.VERTICAL_SPLIT
51 : JSplitPane.HORIZONTAL_SPLIT);
52 }
53 }