home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Insets;
- import java.awt.Panel;
-
- public class JDPSplitPanel extends Panel {
- JDPUser user;
- static boolean activated;
- JDPSplitLayout thisLayout;
- Insets thisInsets;
- Panel dragXPanel;
- Panel dragYPanel;
- int saveXpos;
- int saveYpos;
- Color saveColor;
- boolean draggingXPanel;
- boolean draggingYPanel;
- public static final int PANEL_RESIZED = 10011;
-
- public void setLeftPercentage(float var1) {
- this.thisLayout.setLeftPercentage(var1);
- ((Container)this).layout();
- ((Component)this).paintAll(((Component)this).getGraphics());
- }
-
- public float getLeftPercentage() {
- return this.thisLayout.getLeftPercentage();
- }
-
- public void setTopPercentage(float var1) {
- this.thisLayout.setTopPercentage(var1);
- ((Container)this).layout();
- ((Component)this).paintAll(((Component)this).getGraphics());
- }
-
- public float getTopPercentage() {
- return this.thisLayout.getTopPercentage();
- }
-
- public JDPSplitPanel(JDPUser var1) {
- this.createPanel(var1, 1, 1);
- }
-
- public JDPSplitPanel(JDPUser var1, int var2, int var3) {
- this.createPanel(var1, var2, var3);
- }
-
- public Component getBottomLeftComp() {
- return this.thisLayout.lowerLeft;
- }
-
- public Component getBottomRightComp() {
- return this.thisLayout.lowerRight;
- }
-
- public Component getTopLeftComp() {
- return this.thisLayout.upperLeft;
- }
-
- public Component getTopRightComp() {
- return this.thisLayout.upperRight;
- }
-
- public Insets insets() {
- return this.thisInsets;
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 501:
- if (var1.target.equals(this.thisLayout.dragXPanel)) {
- ((Component)this).requestFocus();
- this.saveXpos = var1.x;
- if (this.saveColor == null) {
- this.saveColor = this.dragXPanel.getBackground();
- }
-
- this.thisLayout.dragXPanel.setBackground(JDPUtils.darker(((Component)this).getBackground()));
- this.thisLayout.dragXPanel.repaint();
- this.thisLayout.showXdragPanel(var1.x);
- this.draggingXPanel = true;
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(10);
- }
-
- return true;
- } else {
- if (var1.target.equals(this.thisLayout.dragYPanel)) {
- ((Component)this).requestFocus();
- this.saveYpos = var1.y;
- if (this.saveColor == null) {
- this.saveColor = this.thisLayout.dragYPanel.getBackground();
- }
-
- this.thisLayout.dragYPanel.setBackground(JDPUtils.darker(((Component)this).getBackground()));
- this.thisLayout.dragYPanel.repaint();
- this.thisLayout.showYdragPanel(var1.y);
- this.draggingYPanel = true;
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(8);
- }
-
- return true;
- }
-
- return false;
- }
- case 502:
- if (this.draggingXPanel) {
- this.thisLayout.dragXPanel.setBackground(this.saveColor);
- this.thisLayout.dragXPanel.repaint();
- this.saveColor = null;
- this.draggingXPanel = false;
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(0);
- }
-
- this.thisLayout.moveXdivider(var1.x);
- ((Container)this).layout();
- ((Component)this).paintAll(((Component)this).getGraphics());
- Event var3 = new Event(this, 10011, (Object)null);
- ((Component)this).getParent().postEvent(var3);
- return true;
- } else {
- if (this.draggingYPanel) {
- this.thisLayout.dragYPanel.setBackground(this.saveColor);
- this.thisLayout.dragYPanel.repaint();
- this.saveColor = null;
- this.draggingYPanel = false;
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(0);
- }
-
- this.thisLayout.moveYdivider(var1.y);
- ((Container)this).layout();
- ((Component)this).paintAll(((Component)this).getGraphics());
- Event var2 = new Event(this, 10011, (Object)null);
- ((Component)this).getParent().postEvent(var2);
- return true;
- }
-
- return false;
- }
- case 503:
- case 504:
- if (var1.target.equals(this.thisLayout.dragXPanel)) {
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(10);
- }
-
- return true;
- } else {
- if (var1.target.equals(this.thisLayout.dragYPanel)) {
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(8);
- }
-
- return true;
- }
-
- return false;
- }
- case 505:
- if (var1.target.equals(this.thisLayout.dragXPanel) && !this.draggingXPanel) {
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(0);
- }
-
- return true;
- } else {
- if (var1.target.equals(this.thisLayout.dragYPanel) && !this.draggingYPanel) {
- if (this.user.jdpMainWindow != null) {
- this.user.jdpMainWindow.setCursor(0);
- }
-
- return true;
- }
-
- return false;
- }
- case 506:
- if (this.draggingXPanel) {
- this.thisLayout.showXdragPanel(var1.x);
- return true;
- } else {
- if (this.draggingYPanel) {
- this.thisLayout.showYdragPanel(var1.y);
- return true;
- }
-
- return false;
- }
- default:
- if (this.draggingXPanel) {
- this.thisLayout.showXdragPanel(var1.x);
- }
-
- if (this.draggingYPanel) {
- this.thisLayout.showYdragPanel(var1.y);
- }
-
- return false;
- }
- }
-
- void createPanel(JDPUser var1, int var2, int var3) {
- this.user = var1;
- activated = JDPUser.classactivated;
- if (!activated) {
- System.out.println("Software Violation - this class may only be used in conjunction with JDesignerPro.");
- } else {
- this.thisInsets = new Insets(0, 0, 0, 0);
- this.dragXPanel = new Panel();
- this.dragYPanel = new Panel();
- this.thisLayout = new JDPSplitLayout(var2, var3);
- this.thisLayout.dragXPanel = this.dragXPanel;
- this.thisLayout.dragYPanel = this.dragYPanel;
- ((Container)this).setLayout(this.thisLayout);
- ((Container)this).add(this.dragXPanel);
- ((Container)this).add(this.dragYPanel);
- }
- }
- }
-