⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdatabcontrol.java

📁 很好的UI界面源码..还有自己的输入法,可以更换风格.可以学习和使用
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        repaintControl();    }    public boolean isStretchImage() {        return stretchImage;    }    public void setStretchImage(boolean stretchImage) {        this.stretchImage = stretchImage;        repaintControl();    }    public int getGlyphAlignType() {        return glyphAlignType;    }    public void setGlyphAlignType(int glyphAlignType) {        this.glyphAlignType = glyphAlignType;        repaintControl();    }    public int getButtonSize() {        return buttonSize;    }    public void setButtonSize(int buttonSize) {        this.buttonSize = buttonSize;        repaintControl();    }    public int getButtonPosition() {        return buttonPosition;    }    public int getScrollButtonColor() {        return scrollButtonColor;    }    public void setScrollButtonColor(int scrollButtonColor) {        this.scrollButtonColor = scrollButtonColor;        repaintControl();    }    public int getScrollButtonSize() {        return scrollButtonSize;    }    public void setScrollButtonSize(int scrollButtonSize) {        this.scrollButtonSize = scrollButtonSize;    }    public void setButtonPosition(int buttonPosition) {        this.buttonPosition = buttonPosition;        if (buttonPosition == SDAConsts.tabButtonsTop || buttonPosition == SDAConsts.tabButtonsBottom) {            buttonAlignType = SDAConsts.ktHorizontal;        }        if (buttonPosition == SDAConsts.tabButtonsLeft || buttonPosition == SDAConsts.tabButtonsRight) {            buttonAlignType = SDAConsts.ktVertical;        }        repaintControl();    }//组件处理    public void clear() {        controlList.removeAllElements();        repaintControl();    }    private void prior() {        //向前滚动        int index = controlList.indexOf(curSheet);        if (index > 0) {            curSheet = (SDATabSheet) controlList.elementAt(index - 1);            doChange();            if (StartButtonPos > curSheet.getIndex()) {                StartButtonPos--;            }        }    }    private void next() {        //向后滚动        int index = controlList.indexOf(curSheet);        if (index < controlList.size() - 1) {            curSheet = (SDATabSheet) controlList.elementAt(index + 1);            doChange();            if (endButtonPos < curSheet.getIndex()) {                StartButtonPos++;            }        }    }    //设置活动页面    public void setActivePage(int index) {        if (index < controlList.size() && index > -1) {            curSheet = (SDATabSheet) controlList.elementAt(index);            doChange();            repaintControl();        }    }    public void setActivePage(SDATabSheet sheet) {        if (sheet != null && controlList.contains(sheet)) {            curSheet = sheet;            doChange();            repaintControl();        }    }    public SDATabSheet getActivePage() {        return curSheet;    }    public int getPageCount() {        return controlList.size();    }    private void doKeyUp(int keyCode) {        String key = form.getKeyName(keyCode).toUpperCase();        if ((key.equals(SDAConsts.KEY_LEFT) && (buttonAlignType == SDAConsts.ktHorizontal)) ||                (key.equals(SDAConsts.KEY_UP) && (buttonAlignType == SDAConsts.ktVertical))) {            //左            prior();            repaintControl();        }        if ((key.equals(SDAConsts.KEY_RIGHT) && (buttonAlignType == SDAConsts.ktHorizontal)) ||                (key.equals(SDAConsts.KEY_DOWN) && (buttonAlignType == SDAConsts.ktVertical))) {            //右            next();            repaintControl();        }    }    private void doPointerPress(int x, int y) {        int posx = screenXToClient(x);        int posy = screenYToClient(y);        if (buttonAlignType == SDAConsts.ktHorizontal) {            if (InClientRect(posx, posy, width - scrollButtonSize * 2, offset, scrollButtonSize, scrollButtonSize)) {                //左边按钮                if (StartButtonPos > 0) {                    StartButtonPos--;                }                return;            }            if (InClientRect(posx, posy, width - scrollButtonSize, offset, scrollButtonSize, scrollButtonSize)) {                //右边按钮                if (canScroll) {                    StartButtonPos++;                }                return;            }        }        if (buttonAlignType == SDAConsts.ktVertical) {            if (InClientRect(posx, posy, offset + SelectbuttonSize - scrollButtonSize, height - scrollButtonSize * 2, scrollButtonSize, scrollButtonSize)) {                //左边按钮                if (StartButtonPos > 0) {                    StartButtonPos--;                }                return;            }            if (InClientRect(posx, posy, offset + SelectbuttonSize - scrollButtonSize, height - scrollButtonSize, scrollButtonSize, scrollButtonSize)) {                //右边按钮                if (canScroll) {                    StartButtonPos++;                }                return;            }        }        if (buttonAlignType == SDAConsts.ktHorizontal) {            if (InClientRect(posx, posy, 0, offset, width, SelectbuttonSize)) {                getButtonFromPoint(posx, posy);            }        } else {            if (InClientRect(posx, posy, offset,0,SelectbuttonSize, height)) {                getButtonFromPoint(posx, posy);            }        }    }    private void getButtonFromPoint(int x, int y) {        int buttonPos = 0;        SDATabSheet button = null;        if (buttonAlignType == SDAConsts.ktHorizontal) {            //水平方向,判断x(相对坐标)            for (int i = StartButtonPos; i < controlList.size(); i++) {                button = (SDATabSheet) controlList.elementAt(i);                //判断是否在中间                if (x > buttonPos && x < buttonPos + button.getButtonWidth()) {                    curSheet = button;                    break;                }                buttonPos += button.getButtonWidth();            }        }        //System.out.println(y+"/"+SDAConsts.ktVertical);        if (buttonAlignType == SDAConsts.ktVertical) {            //水平方向,判断x(相对坐标)            for (int i = StartButtonPos; i < controlList.size(); i++) {                button = (SDATabSheet) controlList.elementAt(i);                //判断是否在中间                if (y > buttonPos && y < buttonPos + button.getButtonHeight()) {                    curSheet = button;                    break;                }                buttonPos += button.getButtonHeight();            }        }    }    public void setOnChangeEvent(TabSheetChangeEvent onChangeEvent) {        this.onChangeEvent = onChangeEvent;    }    private void doChange() {        if (onChangeEvent != null) {            onChangeEvent.Event(curSheet);        }    }    private boolean isFirst() {        if (controlList.indexOf(curSheet) == 0) {            return true;        } else {            return false;        }    }    private boolean isLast() {        if (controlList.indexOf(curSheet) == controlList.size() - 1) {            return true;        } else {            return false;        }    }    protected boolean canDownTabNext() {        if (buttonAlignType == SDAConsts.ktHorizontal) {            return true;        } else {            boolean result = false;            if (isLast()) {                result = true;            }            return result;        }    }    protected boolean canLeftTabPrior() {        if (buttonAlignType == SDAConsts.ktHorizontal) {            boolean result = false;            if (isFirst()) {                result = true;            }            return result;        } else {            return true;        }    }    protected boolean canRightTabNext() {        if (buttonAlignType == SDAConsts.ktHorizontal) {            boolean result = false;            if (isLast()) {                result = true;            }            return result;        } else {            return true;        }    }    protected boolean canUpTabPrior() {        if (buttonAlignType == SDAConsts.ktHorizontal) {            return true;        } else {            boolean result = false;            if (isFirst()) {                result = true;            }            return result;        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -