home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Insets;
- import java.awt.Panel;
- import java.awt.Scrollbar;
-
- public class JDPScrollPanel extends Panel {
- static boolean activated;
- JDPRowLayout thisLayout;
- Scrollbar scrollEast;
- Scrollbar scrollSouth;
- int xOffset;
- int yOffset;
- Insets thisInsets;
- boolean dropEvent;
-
- public JDPScrollPanel() {
- 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(3, 5, 0, 0);
- this.thisLayout = new JDPRowLayout(3, 1);
- ((Container)this).setLayout(this.thisLayout);
- this.scrollEast = new Scrollbar(1, 0, 100, 0, 100);
- ((Container)this).add("scrollEast", this.scrollEast);
- this.scrollSouth = new Scrollbar(0, 0, 100, 0, 100);
- ((Container)this).add("scrollSouth", this.scrollSouth);
- }
- }
-
- public JDPScrollPanel(boolean var1) {
- activated = JDPUser.classactivated;
- if (!activated) {
- System.out.println("Software Violation - this class may only be used in conjunction with JDesignerPro.");
- } else {
- this.thisLayout = new JDPRowLayout(3, 1, var1);
- this.thisInsets = new Insets(3, 5, 0, 0);
- ((Container)this).setLayout(this.thisLayout);
- this.scrollEast = new Scrollbar(1, 0, 100, 0, 100);
- ((Container)this).add("scrollEast", this.scrollEast);
- this.scrollSouth = new Scrollbar(0, 0, 100, 0, 100);
- ((Container)this).add("scrollSouth", this.scrollSouth);
- }
- }
-
- public Component getLeftComp(int var1) {
- return var1 >= this.thisLayout.leftc.length ? null : this.thisLayout.leftc[var1];
- }
-
- public Component getRightComp(int var1) {
- return var1 >= this.thisLayout.rightc.length ? null : this.thisLayout.rightc[var1];
- }
-
- public Insets insets() {
- return this.thisInsets;
- }
-
- public boolean handleEvent(Event var1) {
- Dimension var2 = ((Component)this).size();
- if (var1.target.equals(this.scrollEast)) {
- switch (var1.id) {
- case 601:
- this.dropEvent = true;
- this.yOffset -= 20;
- break;
- case 602:
- this.dropEvent = true;
- this.yOffset += 20;
- break;
- case 603:
- this.dropEvent = true;
- this.yOffset -= var2.height;
- break;
- case 604:
- this.dropEvent = true;
- this.yOffset += var2.height;
- break;
- case 605:
- if (this.dropEvent) {
- this.dropEvent = false;
- return true;
- }
-
- this.yOffset = this.scrollEast.getValue();
- break;
- default:
- this.dropEvent = false;
- }
-
- this.reDrawPanel();
- var1.target = this;
- super.handleEvent(var1);
- return false;
- } else if (var1.target.equals(this.scrollSouth)) {
- switch (var1.id) {
- case 601:
- this.dropEvent = true;
- this.xOffset -= 20;
- break;
- case 602:
- this.dropEvent = true;
- this.xOffset += 20;
- break;
- case 603:
- this.dropEvent = true;
- this.xOffset -= var2.width;
- break;
- case 604:
- this.dropEvent = true;
- this.xOffset += var2.width;
- break;
- case 605:
- if (this.dropEvent) {
- this.dropEvent = false;
- return true;
- }
-
- this.xOffset = this.scrollSouth.getValue();
- break;
- default:
- this.dropEvent = false;
- }
-
- this.reDrawPanel();
- var1.target = this;
- super.handleEvent(var1);
- return false;
- } else {
- this.dropEvent = false;
- return false;
- }
- }
-
- public int getLineCount() {
- int var1 = 0;
-
- for(int var2 = 0; var2 < this.thisLayout.leftc.length; ++var2) {
- if (this.thisLayout.leftc[var2] != null || this.thisLayout.rightc[var2] != null) {
- var1 = var2 + 1;
- }
- }
-
- return var1;
- }
-
- public void reDrawPanel() {
- Dimension var1 = ((Component)this).size();
- Dimension var2 = ((Container)this).preferredSize();
- if (this.xOffset < 0) {
- this.xOffset = 0;
- }
-
- if (this.xOffset > var2.width - var1.width) {
- this.xOffset = var2.width - var1.width;
- }
-
- if (this.yOffset < 0) {
- this.yOffset = 0;
- }
-
- if (this.yOffset > var2.height - var1.height) {
- this.yOffset = var2.height - var1.height;
- }
-
- int var3 = 0;
- int var4 = 0;
- if (System.getProperty("java.vendor").startsWith("Netscape") && System.getProperty("java.version").compareTo("1.1.5") < 0 || System.getProperty("java.vendor").startsWith("Microsoft") && System.getProperty("java.version").compareTo("1.1.4") < 0) {
- var3 = var1.width;
- var4 = var1.height;
- }
-
- if (var2.width - 10 >= var1.width) {
- this.scrollEast.setValues(this.yOffset, var1.height, 0, var2.height - var4);
- } else {
- this.scrollEast.setValues(this.yOffset, var1.height, 0, var2.height + 5 - var4);
- }
-
- this.scrollSouth.setValues(this.xOffset, var1.width, 0, var2.width - var3);
- ((Container)this).layout();
- }
- }
-