Skip to content

Commit

Permalink
window update
Browse files Browse the repository at this point in the history
updated gui look
  • Loading branch information
tyherox committed Feb 22, 2015
1 parent f98813e commit dfb82e1
Show file tree
Hide file tree
Showing 16 changed files with 290 additions and 170 deletions.
249 changes: 157 additions & 92 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions logReport.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

initialized Debugger
initialized Mainframe
1440
900
1920
1200
initialized checkPane
initialized wPad
Binary file modified out/production/Rye/CustomScroll.class
Binary file not shown.
Binary file modified out/production/Rye/JToolBox$extendAnimation.class
Binary file not shown.
Binary file modified out/production/Rye/JToolBox$extendedChecker.class
Binary file not shown.
Binary file modified out/production/Rye/JToolBox$toolOptions.class
Binary file not shown.
Binary file modified out/production/Rye/JToolBox.class
Binary file not shown.
Binary file modified out/production/Rye/wPad$1.class
Binary file not shown.
Binary file modified out/production/Rye/wPad$2$1.class
Binary file not shown.
Binary file modified out/production/Rye/wPad$2.class
Binary file not shown.
Binary file modified out/production/Rye/wPad$3.class
Binary file not shown.
Binary file modified out/production/Rye/wPad$4.class
Binary file not shown.
Binary file modified out/production/Rye/wPad.class
Binary file not shown.
10 changes: 5 additions & 5 deletions src/CustomScroll.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CustomScroll extends JPanel {
public CustomScroll(int X, final int Y, final Dimension screenSize) throws IOException {
setLayout(null);
thumb = new JPanel();
Color c= new Color(25, 27, 36, 255);
Color c= Color.BLACK;
thumb.setBackground(c);
thumb.addMouseListener(new MouseAdapter() {
@Override
Expand Down Expand Up @@ -60,16 +60,16 @@ public void mouseDragged(MouseEvent evt) {
}
});
add(thumb);

sy= Y;
py = getY();

sx= X;
px = getX();

thumb.setBounds(px, py, sx, sy);
}

public void updateGraphic(double pChange, double sChange) {
py = (int) (pChange*sy);
int ny = (int) (sChange*sy);
Expand Down
7 changes: 2 additions & 5 deletions src/JToolBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ public class JToolBox extends JPanel {
toolOptions expanded;
Rectangle expandedArea;

public JToolBox(JLayeredPane m, Dimension d) throws IOException {
master = m;
int toolBoxX = (d.width / 2) + (d.width / 2) / 2;
int toolBoxY = (int) ((d.height / 2) - (d.height / 2) / 1.5);
setBounds(toolBoxX, toolBoxY, d.width / 21, d.height / 3);
public JToolBox(JLayeredPane m, Point point, Dimension size, JTextPane editor) throws IOException {
setBounds(point.x, point.y, size.width, size.height);
setBackground(Color.GRAY);
setFocusable(true);
setLayout(null);
Expand Down
190 changes: 124 additions & 66 deletions src/wPad.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,67 @@

public class wPad extends JFrame {

public static JLayeredPane contentPane;
private JToolBox jToolBox;
public static JLayeredPane contentPane;
private JToolBox jToolBox;
private subMenu subMenu;
private static checkPane writeArea;
private CustomScroll scrollbar;
private static checkPane writeArea;
private CustomScroll scrollbar;
private JTextField title;
private JPanel quickLabel;
private JLabel wc;
private JLabel pc;
boolean entered = false;

static Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
static final double writeAreaH = screenSize.height/3*2;

static final Dimension windowSize = new Dimension(screenSize.width/2, (int) (screenSize.height/1.5));
static final Point windowPoint = new Point(screenSize.width/4, (int) (screenSize.height/5));

static final Dimension quickSize = new Dimension(windowSize.width/2, windowSize.height/30);
static final Point quickPoint = new Point((windowPoint.x+windowSize.width/2)-windowSize.width/4, (windowPoint.y+windowSize.height+windowSize.height/20));

static final Dimension toolBoxSize = new Dimension(windowSize.width/10, windowSize.height);
static final Point toolBoxPoint = new Point(windowPoint.x+windowSize.width+windowSize.width/100,windowPoint.y);

static final Dimension titleSize = new Dimension(windowSize.width/2, windowSize.height/15);
static final Point titlePoint = new Point((windowPoint.x+windowSize.width/2)-windowSize.width/4, (windowPoint.y-windowSize.height/10));

static final double writeAreaH = windowSize.height;

int word = 0;

/**
* Launch the application.
*/
public static void main(String[] args) {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
public void run() {
try {
wPad frame = new wPad();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
* @throws java.io.IOException
*/

public wPad() throws IOException, URISyntaxException {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
* @throws java.io.IOException
*/

public wPad() throws IOException, URISyntaxException {
Debug.initialize();
Mainframe.initialize();
//--- screen variables ---//
Debug.Log(String.valueOf(screenSize.width));
Debug.Log(String.valueOf(screenSize.height));
Dimension SIZE = new Dimension(screenSize.width/2, (int) (screenSize.height/1.5));

//--- frame settings ---//
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, SIZE.width*2, (int) (SIZE.height*1.5));
Color color= new Color(73, 73, 73, 255);
setBounds(100, 100, screenSize.width, screenSize.height);
Color color= new Color(24, 25, 34, 255);
setBackground(color);

//--- main panel ---//
Expand All @@ -62,7 +79,7 @@ public wPad() throws IOException, URISyntaxException {

//--- window panel ---//
JScrollPane window = new JScrollPane();
window.setBounds((screenSize.width / 2) - (SIZE.width / 2), (screenSize.height / 2) - (SIZE.height / 2), SIZE.width, SIZE.height);
window.setBounds(windowPoint.x, windowPoint.y, windowSize.width, windowSize.height);
window.setBackground(Color.YELLOW);
window.setBorder(null);
window.setHorizontalScrollBar(null);
Expand All @@ -74,30 +91,65 @@ public wPad() throws IOException, URISyntaxException {
contentPane.add(window);

//--- tool panel ---//
int toolBoxX = (screenSize.width / 2) + SIZE.width / 2;
int toolBoxY = (screenSize.height / 2) - (SIZE.height / 2);
entered = true;
jToolBox = new JToolBox(contentPane,new Dimension(screenSize.width, screenSize.height));
jToolBox = new JToolBox(contentPane,toolBoxPoint,toolBoxSize,writeArea);
contentPane.add(jToolBox);

//--- tools ---//
quickLabel = new JPanel();
quickLabel.setBounds(quickPoint.x, quickPoint.y, quickSize.width, quickSize.height);
quickLabel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 5));
quickLabel.setOpaque(false);

wc = new JLabel("Word Count: ",SwingConstants.CENTER);
wc.setForeground(Color.WHITE);
wc.setBorder(BorderFactory.createEmptyBorder());
wc.setBounds((window.getX()+window.getWidth()/2)-SIZE.width/10, (window.getY()+window.getHeight()+window.getHeight()/20), SIZE.width/5, 10);
contentPane.add(wc);
quickLabel.add(wc);

pc = new JLabel("Page Count: ",SwingConstants.CENTER);
pc.setForeground(Color.WHITE);
pc.setBorder(BorderFactory.createEmptyBorder());
quickLabel.add(pc);

contentPane.add(quickLabel);

//--- Options ---//
subMenu = new subMenu(new Dimension(screenSize.width/10,screenSize.height/12));
subMenu.setBackground(Color.GRAY);
contentPane.add(subMenu,JLayeredPane.MODAL_LAYER);

//--- seperators ---//
JPanel separatorL = new JPanel();
separatorL.setBackground(Color.WHITE);
separatorL.setBounds(windowPoint.x, windowPoint.y, windowSize.width / 40, windowSize.height);
contentPane.add(separatorL,JLayeredPane.MODAL_LAYER);

JPanel seperatorR = new JPanel();
seperatorR.setBackground(Color.WHITE);
seperatorR.setBounds(windowPoint.x + windowSize.width - separatorL.getWidth(), windowPoint.y, windowSize.width / 40, windowSize.height);
contentPane.add(seperatorR,JLayeredPane.MODAL_LAYER);

JPanel seperatorT = new JPanel();
seperatorT.setBackground(Color.WHITE);
seperatorT.setBounds(titlePoint.x, titlePoint.y + titlePoint.y / 3, titleSize.width, titleSize.height / 20);
contentPane.add(seperatorT,JLayeredPane.MODAL_LAYER);

//--- title ---///
title = new JTextField("title");
title.setBounds(titlePoint.x, titlePoint.y, titleSize.width, titleSize.height);
title.setBorder(null);
title.setOpaque(false);
title.setForeground(Color.white);
title.setFont(new Font("굴림", Font.PLAIN, 30));
title.setHorizontalAlignment(JTextField.CENTER);
contentPane.add(title);

//--- writing area ---//
writeArea = new checkPane();
writeArea.setBackground(Color.BLACK);
writeArea.setFont(new Font("Monospaced", Font.PLAIN, 21));
writeArea.setMargin(new Insets(50, 80, 50, 80));
writeArea.setPreferredSize(new Dimension(SIZE.width, SIZE.height));
writeArea.setPreferredSize(new Dimension(windowSize.width, windowSize.height));
writeArea.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
//System.out.println(e.getKeyCode());
Expand Down Expand Up @@ -129,8 +181,7 @@ public void filler() {
}

});
//writeArea.setFont();
//writeArea.setOpaque(false);
writeArea.setOpaque(false);
writeArea.setCaretColor(Color.WHITE);
writeArea.getCaret().setBlinkRate(800);
writeArea.addMouseListener(new MouseAdapter() {
Expand Down Expand Up @@ -159,10 +210,15 @@ else if(e.isControlDown())
window.setViewportView(writeArea);

//--- scrollbar implementation ---//
scrollbar = new CustomScroll(screenSize.width/20,screenSize.height+screenSize.height/100,screenSize);
scrollbar.setBounds(screenSize.width/50, 0, screenSize.width/20, screenSize.height+screenSize.height/100);
Color c= new Color(88, 88, 88, 255);
scrollbar = new CustomScroll(screenSize.width/17,screenSize.height+screenSize.height/100,screenSize);
scrollbar.setBounds(screenSize.width/50, 0, screenSize.width/17, screenSize.height+screenSize.height/100);
JPanel decoration = new JPanel();
decoration.setBounds(scrollbar.getWidth()/4, 0, scrollbar.getWidth()/2, screenSize.height+screenSize.height/100);
decoration.setBackground(Color.DARK_GRAY);
Color c= new Color(148, 138, 138, 255);
scrollbar.add(decoration);
scrollbar.setBackground(c);

contentPane.add(scrollbar);

//--- scrollbar optimization ---//
Expand Down Expand Up @@ -194,33 +250,35 @@ public void adjustmentValueChanged(AdjustmentEvent e) {
Debug.Log("initialized wPad");
}

public static void scroll(String c, double i)
public static void scroll(String c, double i)
{
if(c.equals("up"))
{
if(c.equals("up"))
{
double percentage = i*writeArea.getHeight();
Rectangle r = new Rectangle(1,(int)percentage,1,1);
writeArea.scrollRectToVisible(r);
contentPane.revalidate();
contentPane.repaint();
}
if(c.equals("down"))
{
double percentage = i*writeArea.getHeight()+writeAreaH;
Rectangle r = new Rectangle(1,(int)percentage,1,1);
writeArea.scrollRectToVisible(r);
contentPane.revalidate();
contentPane.repaint();
}
else
{
double percentage = i*writeArea.getHeight();
Rectangle r = new Rectangle(1,(int)percentage,1,1);
writeArea.scrollRectToVisible(r);
contentPane.revalidate();
contentPane.repaint();
}
double percentage = i*writeArea.getHeight();
Rectangle r = new Rectangle(1,(int)percentage,1,1);
writeArea.scrollRectToVisible(r);
contentPane.revalidate();
contentPane.repaint();
}
}
if(c.equals("down"))
{
double percentage = i*writeArea.getHeight()+writeAreaH;
Rectangle r = new Rectangle(1,(int)percentage,1,1);
writeArea.scrollRectToVisible(r);
contentPane.revalidate();
contentPane.repaint();
}
else
{
double percentage = i*writeArea.getHeight();
Rectangle r = new Rectangle(1,(int)percentage,1,1);
writeArea.scrollRectToVisible(r);
contentPane.revalidate();
contentPane.repaint();
}
}


}


0 comments on commit dfb82e1

Please sign in to comment.