mirror of
https://github.com/2006-Scape/2006RebottedClient.git
synced 2026-07-02 16:49:02 +00:00
::06 & ::osrs commands to switch GameFrames
This commit is contained in:
Generated
+2
@@ -0,0 +1,2 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2906,20 +2906,22 @@ public class Client extends GameApplet {
|
||||
|
||||
public void drawSideIcons() {
|
||||
|
||||
// local variables will not stay in memory which will help with
|
||||
// performance.
|
||||
final int[] sideIconsX = {17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216},
|
||||
sideIconsY = {9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303},
|
||||
sideIconsId = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
|
||||
sideIconsTab = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
|
||||
|
||||
int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
|
||||
int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
|
||||
int[] x;
|
||||
int[] y;
|
||||
if(frameMode == ScreenMode.FIXED && !Configuration.OSRS_GAMEFRAME) {
|
||||
x = GameFrameIds.REDONE_ICONS_X;
|
||||
y = GameFrameIds.REDONE_ICONS_Y;
|
||||
} else {
|
||||
x = GameFrameIds.OSRS_ICONS_X;
|
||||
y = GameFrameIds.OSRS_ICONS_Y;
|
||||
}
|
||||
if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) {
|
||||
for (int i = 0; i < sideIconsTab.length; i++) {
|
||||
if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
|
||||
if (sideIconsId[i] != -1) {
|
||||
sideIcons[sideIconsId[i]].drawSprite(sideIconsX[i] + xOffset, sideIconsY[i] + yOffset);
|
||||
for (int i = 0; i < GameFrameIds.SIDE_ICONS_ID.length; i++) {
|
||||
if (tabInterfaceIDs[GameFrameIds.SIDE_ICONS_ID[i]] != -1) {
|
||||
if (GameFrameIds.SIDE_ICONS_ID[i] != -1) {
|
||||
sideIcons[GameFrameIds.SIDE_ICONS_ID[i]].drawSprite(x[i] + xOffset, y[i] + yOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2927,8 +2929,8 @@ public class Client extends GameApplet {
|
||||
int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13};
|
||||
int[] iconX = {219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28};
|
||||
int[] iconY = {67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32};
|
||||
for (int i = 0; i < sideIconsTab.length; i++) {
|
||||
if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
|
||||
for (int i = 0; i < GameFrameIds.SIDE_ICONS_ID.length; i++) {
|
||||
if (tabInterfaceIDs[GameFrameIds.SIDE_ICONS_ID[i]] != -1) {
|
||||
if (iconId[i] != -1) {
|
||||
sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], frameHeight - iconY[i]);
|
||||
}
|
||||
@@ -2938,8 +2940,8 @@ public class Client extends GameApplet {
|
||||
int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13};
|
||||
int[] iconX = {50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433};
|
||||
int[] iconY = {30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32};
|
||||
for (int i = 0; i < sideIconsTab.length; i++) {
|
||||
if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
|
||||
for (int i = 0; i < GameFrameIds.SIDE_ICONS_ID.length; i++) {
|
||||
if (tabInterfaceIDs[GameFrameIds.SIDE_ICONS_ID[i]] != -1) {
|
||||
if (iconId[i] != -1) {
|
||||
sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], frameHeight - iconY[i]);
|
||||
}
|
||||
@@ -2950,16 +2952,24 @@ public class Client extends GameApplet {
|
||||
|
||||
private void drawRedStones() {
|
||||
|
||||
final int[] redStonesX = {6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209},
|
||||
redStonesY = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298},
|
||||
redStonesId = {35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38};
|
||||
|
||||
int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
|
||||
int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
|
||||
int[] stones;
|
||||
int[] x;
|
||||
int[] y;
|
||||
if(frameMode == ScreenMode.FIXED && !Configuration.OSRS_GAMEFRAME) {
|
||||
stones = GameFrameIds.REDONE_STONES_IDS;
|
||||
x = GameFrameIds.REDONE_STONES_X;
|
||||
y = GameFrameIds.REDONE_STONES_Y;
|
||||
} else {
|
||||
stones = GameFrameIds.OSRS_STONES_IDS;
|
||||
x = GameFrameIds.OSRS_STONES_X;
|
||||
y = GameFrameIds.OSRS_STONES_Y;
|
||||
}
|
||||
if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) {
|
||||
if (tabInterfaceIDs[tabId] != -1 && tabId != 15) {
|
||||
SpriteCache.lookup(redStonesId[tabId]).drawSprite(redStonesX[tabId] + xOffset,
|
||||
redStonesY[tabId] + yOffset);
|
||||
SpriteCache.lookup(stones[tabId]).drawSprite(x[tabId] + xOffset,
|
||||
y[tabId] + yOffset);
|
||||
}
|
||||
} else if (changeTabArea && frameWidth < 1000) {
|
||||
int[] stoneX = {226, 194, 162, 130, 99, 65, 34, 219, 195, 161, 130, 98, 65, 33};
|
||||
@@ -2985,12 +2995,18 @@ public class Client extends GameApplet {
|
||||
tabImageProducer.initDrawingArea();
|
||||
}
|
||||
Rasterizer3D.scanOffsets = anIntArray1181;
|
||||
final int fixedInventory;
|
||||
if(Configuration.OSRS_GAMEFRAME) {
|
||||
fixedInventory = GameFrameIds.OSRS_INVENTORY;
|
||||
} else {
|
||||
fixedInventory = GameFrameIds.REDONE_INVENTORY;
|
||||
}
|
||||
if (frameMode == ScreenMode.FIXED) {
|
||||
SpriteCache.lookup(21).drawSprite(0, 0);
|
||||
SpriteCache.lookup(fixedInventory).drawSprite(0, 0);
|
||||
} else if (frameMode != ScreenMode.FIXED && !changeTabArea) {
|
||||
Rasterizer2D.drawTransparentBox(frameWidth - 217, frameHeight - 304, 195, 270, 0x3E3529,
|
||||
transparentTabArea ? 80 : 256);
|
||||
SpriteCache.lookup(47).drawSprite(xOffset, yOffset);
|
||||
SpriteCache.lookup(GameFrameIds.OSRS_INVENTORY_2).drawSprite(xOffset, yOffset);
|
||||
} else {
|
||||
if (frameWidth >= 1000) {
|
||||
if (showTabComponents) {
|
||||
@@ -6551,6 +6567,19 @@ public class Client extends GameApplet {
|
||||
frameMode(ScreenMode.FIXED);
|
||||
}
|
||||
|
||||
if (inputString.equals("::osrs")) {
|
||||
Configuration.OSRS_GAMEFRAME = true;
|
||||
drawRedStones();
|
||||
drawSideIcons();
|
||||
drawTabArea();
|
||||
}
|
||||
if (inputString.equals("::06")) {
|
||||
Configuration.OSRS_GAMEFRAME = false;
|
||||
drawRedStones();
|
||||
drawSideIcons();
|
||||
drawTabArea();
|
||||
}
|
||||
|
||||
if (inputString.equals("::resize")) {
|
||||
frameMode(ScreenMode.RESIZABLE);
|
||||
}
|
||||
@@ -7964,6 +7993,7 @@ public class Client extends GameApplet {
|
||||
return;
|
||||
}
|
||||
if (response == 2) {
|
||||
botFrame.setTitle(Configuration.CLIENT_NAME + " - ["+StringUtils.capitalizeEachWord(myUsername)+"]");
|
||||
myPrivilege = socketStream.read();
|
||||
flagged = socketStream.read() == 1;
|
||||
aLong1220 = 0L;
|
||||
@@ -13703,7 +13733,7 @@ public class Client extends GameApplet {
|
||||
menuActionRow = 2;
|
||||
}
|
||||
if (hpHover && Configuration.enableOrbs) {
|
||||
menuActionText[1] = Configuration.hpAboveHeads ? "Turn HP Above Heads on" : "Turn HP Above heads off";
|
||||
menuActionText[1] = Configuration.hpAboveHeads ? "Turn HP Above Heads on" : "Turn HP Above Heads off";
|
||||
menuActionTypes[1] = 1508;
|
||||
menuActionRow = 2;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public final class Configuration {
|
||||
|
||||
}
|
||||
|
||||
public static boolean OSRS_GAMEFRAME = false;
|
||||
|
||||
public static final BigInteger RSA_MODULUS = new BigInteger(
|
||||
"91553247461173033466542043374346300088148707506479543786501537350363031301992107112953015516557748875487935404852620239974482067336878286174236183516364787082711186740254168914127361643305190640280157664988536979163450791820893999053469529344247707567448479470137716627440246788713008490213212272520901741443");
|
||||
|
||||
|
||||
@@ -70,7 +70,10 @@ public class GameApplet extends Applet implements Runnable, MouseListener,
|
||||
public void refreshFrameSize(boolean undecorated, int width, int height,
|
||||
boolean resizable, boolean full) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
Client.botFrame.setResizable(true);
|
||||
if(!resizable) {
|
||||
Client.botFrame.setSize(new Dimension(774, 559));
|
||||
}
|
||||
Client.botFrame.setResizable(resizable);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -263,6 +266,8 @@ public class GameApplet extends Applet implements Runnable, MouseListener,
|
||||
public void mouseWheelMoved(MouseWheelEvent event) {
|
||||
int rotation = event.getWheelRotation();
|
||||
handleInterfaceScrolling(event);
|
||||
final Rectangle viewport = new Rectangle(0, 0, 515,335);
|
||||
final Point p = new Point(mouseX, mouseY);
|
||||
if (mouseX > 0 && mouseX < 512 && mouseY > Client.frameHeight - 165
|
||||
&& mouseY < Client.frameHeight - 25) {
|
||||
int scrollPos = Client.anInt1089;
|
||||
@@ -275,6 +280,14 @@ public class GameApplet extends Applet implements Runnable, MouseListener,
|
||||
Client.anInt1089 = scrollPos;
|
||||
Client.updateChatbox = true;
|
||||
}
|
||||
} else {
|
||||
if(Client.loggedIn && viewport.contains(p)) {
|
||||
if (Client.cameraZoom < 1800 && rotation == 1) {
|
||||
Client.cameraZoom = Client.cameraZoom + 20;
|
||||
} else if (Client.cameraZoom > 20 && rotation == -1) {
|
||||
Client.cameraZoom = Client.cameraZoom - 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.rebotted;
|
||||
|
||||
public class GameFrameIds {
|
||||
|
||||
public static int OSRS_INVENTORY = 21;
|
||||
|
||||
public static int OSRS_INVENTORY_2 = 47;
|
||||
|
||||
public static int REDONE_INVENTORY = 62;
|
||||
|
||||
public static int[] OSRS_STONES_X = {6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209};
|
||||
|
||||
public static int[] REDONE_STONES_X = {20, 52, 80, 108, 151, 179, 207, 20, 52, 80, 108, 151, 179, 207};
|
||||
|
||||
public static int[] OSRS_STONES_Y = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298};
|
||||
|
||||
public static int[] REDONE_STONES_Y = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298};
|
||||
|
||||
public static int[] OSRS_STONES_IDS = {35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38};
|
||||
|
||||
public static int[] REDONE_STONES_IDS = {63, 72, 68, 65, 70, 71, 64, 66, 70, 71, 69, 72, 68, 67};
|
||||
|
||||
public static int[] OSRS_ICONS_X = {17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216},
|
||||
OSRS_ICONS_Y = {9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303};
|
||||
|
||||
public static int[] REDONE_ICONS_X = {29, 54, 84, 116, 153, 182, 210, 28, 56, 84, 118, 155, 185, 210},
|
||||
REDONE_ICONS_Y = {10, 8, 7, 5, 2, 3, 9, 300, 306, 306, 302, 305, 303, 303, 303};
|
||||
|
||||
public static int[] SIDE_ICONS_ID = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
|
||||
|
||||
}
|
||||
+11
-2
@@ -22,7 +22,8 @@ public final class Sprite extends Rasterizer2D {
|
||||
private int offsetY;
|
||||
private int maxWidth;
|
||||
private int maxHeight;
|
||||
|
||||
private byte[] spriteData;
|
||||
|
||||
public Sprite() {
|
||||
|
||||
}
|
||||
@@ -41,7 +42,7 @@ public final class Sprite extends Rasterizer2D {
|
||||
this.maxHeight = height;
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
|
||||
setSpriteData(sprite.getSpriteData());
|
||||
myPixels = new int[width * height];
|
||||
|
||||
System.arraycopy(sprite.myPixels, 0, myPixels, 0, myPixels.length);
|
||||
@@ -59,6 +60,7 @@ public final class Sprite extends Rasterizer2D {
|
||||
maxHeight = myHeight;
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
spriteData = data;
|
||||
myPixels = new int[myWidth * myHeight];
|
||||
PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth);
|
||||
pixelgrabber.grabPixels();
|
||||
@@ -941,4 +943,11 @@ public final class Sprite extends Rasterizer2D {
|
||||
this.maxHeight = maxHeight;
|
||||
}
|
||||
|
||||
public byte[] getSpriteData() {
|
||||
return spriteData;
|
||||
}
|
||||
|
||||
public void setSpriteData(byte[] spriteData) {
|
||||
this.spriteData = spriteData;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-14
@@ -1,10 +1,7 @@
|
||||
package org.rebotted.cache.graphics;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
|
||||
|
||||
import org.rebotted.io.Buffer;
|
||||
import org.rebotted.sign.SignLink;
|
||||
import org.rebotted.util.FileUtils;
|
||||
@@ -14,7 +11,7 @@ public final class SpriteCache {
|
||||
private static Sprite[] sprites;
|
||||
|
||||
private static int totalSprites;
|
||||
|
||||
private static int i = 0;
|
||||
public static void load() {
|
||||
Buffer data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "main_file_sprites.dat"));
|
||||
|
||||
@@ -26,10 +23,9 @@ public final class SpriteCache {
|
||||
|
||||
for (int index = 0; index < totalSprites; index++) {
|
||||
sprites[index] = SpriteCache.decode(dataFile);
|
||||
|
||||
|
||||
sprites[index].setTransparency(255, 0, 255);
|
||||
}
|
||||
|
||||
System.out.println("Sprites Loaded: " + totalSprites);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
@@ -72,25 +68,25 @@ public final class SpriteCache {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Sprite[] getSprites() {
|
||||
return sprites;
|
||||
}
|
||||
|
||||
public static Sprite lookup(int id) {
|
||||
|
||||
public static Sprite lookup(int id) {
|
||||
if (id < 0 || id > sprites.length) {
|
||||
throw new IllegalArgumentException(String.format("Invalid id: %d while trying to lookup a sprite.", id));
|
||||
}
|
||||
}
|
||||
return sprites[id];
|
||||
}
|
||||
|
||||
|
||||
public static void set(int id, Sprite sprite) {
|
||||
if (id < 0 || id > sprites.length) {
|
||||
throw new IllegalArgumentException(String.format("Invalid id: %d while trying to lookup a sprite.", id));
|
||||
}
|
||||
}
|
||||
sprites[id] = sprite;
|
||||
}
|
||||
|
||||
|
||||
public int totalSprites() {
|
||||
return totalSprites;
|
||||
}
|
||||
|
||||
+7
-7
@@ -467,8 +467,8 @@ public final class Widget {
|
||||
rsinterface.height = 20;
|
||||
rsinterface.opacity = 0;
|
||||
rsinterface.mOverInterToTrigger = 52;
|
||||
rsinterface.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
rsinterface.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
rsinterface.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
rsinterface.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
}
|
||||
|
||||
public static void addText(int id, String text, GameFont wid[], int idx, int color) {
|
||||
@@ -1180,7 +1180,7 @@ public final class Widget {
|
||||
Tab.scripts[0][1] = configFrame;
|
||||
Tab.scripts[0][2] = 0;
|
||||
Tab.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
Tab.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
Tab.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
Tab.tooltip = tT;
|
||||
}
|
||||
|
||||
@@ -1464,7 +1464,7 @@ public final class Widget {
|
||||
RSInterface.contentType = 0;
|
||||
RSInterface.opacity = 0;
|
||||
RSInterface.hoverType = 52;
|
||||
RSInterface.disabledSprite = SpriteCache.lookup(spriteId);
|
||||
RSInterface.disabledSprite = SpriteCache.lookup(spriteId);
|
||||
RSInterface.width = 500;
|
||||
RSInterface.height = 500;
|
||||
RSInterface.tooltip = "";
|
||||
@@ -2016,8 +2016,8 @@ public final class Widget {
|
||||
hover.contentType = 0;
|
||||
hover.opacity = 0;
|
||||
hover.hoverType = hoverid;
|
||||
hover.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
hover.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
hover.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
hover.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
hover.width = Width;
|
||||
hover.tooltip = Tooltip;
|
||||
hover.height = Height;
|
||||
@@ -2064,7 +2064,7 @@ public final class Widget {
|
||||
Tab.scripts[0][0] = 5;
|
||||
Tab.scripts[0][1] = configFrame;
|
||||
Tab.scripts[0][2] = 0;
|
||||
Tab.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
Tab.disabledSprite = SpriteCache.lookup(disabledSpriteId);
|
||||
Tab.enabledSprite = SpriteCache.lookup(enabledSpriteId);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,25 +10,18 @@ import java.awt.event.ActionListener;
|
||||
|
||||
public final class BotFrame extends JFrame implements ActionListener {
|
||||
|
||||
private final GameApplet applet;
|
||||
public Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
public Dimension screenSize = toolkit.getScreenSize();
|
||||
public int screenWidth = (int) screenSize.getWidth();
|
||||
public int screenHeight = (int) screenSize.getHeight();
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final BotMenuBar botMenuBar;
|
||||
protected final Insets insets;
|
||||
|
||||
public BotFrame(GameApplet applet, boolean resizable) {
|
||||
this.applet = applet;
|
||||
setTitle(Configuration.CLIENT_NAME);
|
||||
setResizable(resizable);
|
||||
insets = getInsets();
|
||||
botMenuBar = new BotMenuBar(this);
|
||||
setJMenuBar(botMenuBar);
|
||||
add(applet, BorderLayout.CENTER);
|
||||
setMinimumSize(new Dimension(774, 559));
|
||||
setSize(774, 559);
|
||||
setSize(new Dimension(774, 559));
|
||||
pack();
|
||||
setLocationRelativeTo(getParent());
|
||||
setLocationRelativeTo(getOwner());
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.swing.*;
|
||||
public class BotMenuBar extends JMenuBar {
|
||||
private BotFrame botUI;
|
||||
private JButton startButton, pauseButton, stopButton;
|
||||
private JMenu features, file, scripts;
|
||||
private JMenu file, scripts;
|
||||
private JMenuItem run, pause, stop;
|
||||
|
||||
public BotMenuBar(BotFrame botUI) {
|
||||
@@ -25,7 +25,6 @@ public class BotMenuBar extends JMenuBar {
|
||||
private void createMenu() {
|
||||
|
||||
file = new JMenu("File");
|
||||
features = new JMenu("Features");
|
||||
scripts = new JMenu("Script");
|
||||
|
||||
final JMenuItem exit = new JMenuItem("Exit");
|
||||
@@ -76,7 +75,6 @@ public class BotMenuBar extends JMenuBar {
|
||||
private void configureComponents() {
|
||||
removeAll();
|
||||
add(file);
|
||||
add(features);
|
||||
add(scripts);
|
||||
add(Box.createHorizontalGlue());
|
||||
/*add(startButton);
|
||||
@@ -85,11 +83,6 @@ public class BotMenuBar extends JMenuBar {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public JMenu getFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
public JMenu getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -90,4 +90,31 @@ public final class StringUtils {
|
||||
stringbuffer.append("*");
|
||||
return stringbuffer.toString();
|
||||
}
|
||||
|
||||
public static String capitalizeEachWord(String str){
|
||||
|
||||
if(str == null || str.length() == 0)
|
||||
return "";
|
||||
|
||||
if(str.length() == 1)
|
||||
return str.toUpperCase();
|
||||
|
||||
String[] words = str.split(" ");
|
||||
|
||||
StringBuilder sbCapitalizedWords = new StringBuilder(str.length());
|
||||
|
||||
for(String word : words){
|
||||
|
||||
if(word.length() > 1)
|
||||
sbCapitalizedWords
|
||||
.append(word.substring(0, 1).toUpperCase())
|
||||
.append(word.substring(1));
|
||||
else
|
||||
sbCapitalizedWords.append(word.toUpperCase());
|
||||
|
||||
sbCapitalizedWords.append(" ");
|
||||
}
|
||||
|
||||
return sbCapitalizedWords.toString().trim();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user