Skip to content

Commit 42e7e64

Browse files
author
subhra74
committed
added link to github page
1 parent c844be9 commit 42e7e64

File tree

5 files changed

+91
-35
lines changed

5 files changed

+91
-35
lines changed

app/src/main/java/xdman/ui/components/MainWindow.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ public void configChanged() {
114114
protected void registerTitlePanel(JPanel panel) {
115115
showTwitterIcon = true;
116116
showFBIcon = true;
117+
showGitHubIcon = true;
117118
fbUrl = "https://www.facebook.com/XDM.subhra74/";
118119
twitterUrl = "https://twitter.com/XDM_subhra74";
120+
gitHubUrl = "https://github.com/subhra74/xdm";
119121
super.registerTitlePanel(panel);
120122
}
121123

app/src/main/java/xdman/ui/components/XDMFrame.java

Lines changed: 89 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ public class XDMFrame extends JFrame implements ComponentListener {
4848

4949
private JPanel contentPane, modalPane, dialogPane;
5050

51-
private static final int DEFAULT_LAYER = 0, MODAL_LAYER = 30, DIALOG_LAYER = 15;
51+
private static final int DEFAULT_LAYER = 0, MODAL_LAYER = 30,
52+
DIALOG_LAYER = 15;
5253

5354
private Component lastFocusOwner;
5455

55-
protected boolean showTwitterIcon, showFBIcon;
56+
protected boolean showTwitterIcon, showFBIcon, showGitHubIcon;
5657

57-
protected String twitterUrl, fbUrl;
58+
protected String twitterUrl, fbUrl, gitHubUrl;
5859

5960
public XDMFrame() {
6061
setUndecorated(true);
@@ -67,7 +68,8 @@ public XDMFrame() {
6768
createResizeGrip();
6869
panTitle = new TitlePanel(new BorderLayout(), this);
6970
panTitle.setBackground(ColorResource.getTitleColor());
70-
panTitle.setBorder(new EmptyBorder(XDMUtils.getScaledInt(5), XDMUtils.getScaledInt(5), XDMUtils.getScaledInt(0),
71+
panTitle.setBorder(new EmptyBorder(XDMUtils.getScaledInt(5),
72+
XDMUtils.getScaledInt(5), XDMUtils.getScaledInt(0),
7173
XDMUtils.getScaledInt(5)));
7274
panTitle.setOpaque(true);
7375
registerTitlePanel(panTitle);
@@ -117,29 +119,37 @@ public Component add(Component c) {
117119
private void createResizeGrip() {
118120
GripMouseAdapter gma = new GripMouseAdapter();
119121
lblRightGrip = new JLabel();
120-
lblRightGrip.setMaximumSize(new Dimension(2, lblRightGrip.getMaximumSize().height));
121-
lblRightGrip.setPreferredSize(new Dimension(2, lblRightGrip.getPreferredSize().height));
122+
lblRightGrip.setMaximumSize(
123+
new Dimension(2, lblRightGrip.getMaximumSize().height));
124+
lblRightGrip.setPreferredSize(
125+
new Dimension(2, lblRightGrip.getPreferredSize().height));
122126
lblRightGrip.setBackground(Color.BLACK);
123127
lblRightGrip.setOpaque(true);
124128
contentPane.add(lblRightGrip, BorderLayout.EAST);
125129

126130
lblBottomGrip = new JLabel();
127-
lblBottomGrip.setMaximumSize(new Dimension(lblBottomGrip.getPreferredSize().width, 2));
128-
lblBottomGrip.setPreferredSize(new Dimension(lblBottomGrip.getPreferredSize().width, 2));
131+
lblBottomGrip.setMaximumSize(
132+
new Dimension(lblBottomGrip.getPreferredSize().width, 2));
133+
lblBottomGrip.setPreferredSize(
134+
new Dimension(lblBottomGrip.getPreferredSize().width, 2));
129135
lblBottomGrip.setBackground(Color.BLACK);
130136
lblBottomGrip.setOpaque(true);
131137
contentPane.add(lblBottomGrip, BorderLayout.SOUTH);
132138

133139
lblLeftGrip = new JLabel();
134-
lblLeftGrip.setMaximumSize(new Dimension(2, lblLeftGrip.getPreferredSize().height));
135-
lblLeftGrip.setPreferredSize(new Dimension(2, lblLeftGrip.getPreferredSize().height));
140+
lblLeftGrip.setMaximumSize(
141+
new Dimension(2, lblLeftGrip.getPreferredSize().height));
142+
lblLeftGrip.setPreferredSize(
143+
new Dimension(2, lblLeftGrip.getPreferredSize().height));
136144
lblLeftGrip.setBackground(Color.BLACK);
137145
lblLeftGrip.setOpaque(true);
138146
contentPane.add(lblLeftGrip, BorderLayout.WEST);
139147

140148
lblTopGrip = new JLabel();
141-
lblTopGrip.setMaximumSize(new Dimension(lblTopGrip.getPreferredSize().width, 2));
142-
lblTopGrip.setPreferredSize(new Dimension(lblTopGrip.getPreferredSize().width, 2));
149+
lblTopGrip.setMaximumSize(
150+
new Dimension(lblTopGrip.getPreferredSize().width, 2));
151+
lblTopGrip.setPreferredSize(
152+
new Dimension(lblTopGrip.getPreferredSize().width, 2));
143153
lblTopGrip.setBackground(Color.BLACK);
144154
lblTopGrip.setOpaque(true);
145155
contentPane.add(lblTopGrip, BorderLayout.NORTH);
@@ -153,8 +163,10 @@ private void createResizeGrip() {
153163
public void mouseDragged(MouseEvent me) {
154164
int y = me.getYOnScreen();
155165
int diff = XDMFrame.this.getLocationOnScreen().y - y;
156-
XDMFrame.this.setLocation(XDMFrame.this.getLocation().x, me.getLocationOnScreen().y);
157-
XDMFrame.this.setSize(XDMFrame.this.getWidth(), XDMFrame.this.getHeight() + diff);
166+
XDMFrame.this.setLocation(XDMFrame.this.getLocation().x,
167+
me.getLocationOnScreen().y);
168+
XDMFrame.this.setSize(XDMFrame.this.getWidth(),
169+
XDMFrame.this.getHeight() + diff);
158170
}
159171
});
160172

@@ -176,8 +188,10 @@ public void mouseDragged(MouseEvent me) {
176188
public void mouseDragged(MouseEvent me) {
177189
int x = me.getXOnScreen();
178190
int diff = XDMFrame.this.getLocationOnScreen().x - x;
179-
XDMFrame.this.setLocation(me.getLocationOnScreen().x, XDMFrame.this.getLocation().y);
180-
XDMFrame.this.setSize(diff + XDMFrame.this.getWidth(), XDMFrame.this.getHeight());
191+
XDMFrame.this.setLocation(me.getLocationOnScreen().x,
192+
XDMFrame.this.getLocation().y);
193+
XDMFrame.this.setSize(diff + XDMFrame.this.getWidth(),
194+
XDMFrame.this.getHeight());
181195
}
182196
});
183197

@@ -232,38 +246,64 @@ protected void registerTitlePanel(JPanel panel) {
232246
// //menuBtn = btn;
233247
// // hBox.add(Box.createHorizontalStrut(10));
234248
// }
249+
if (showGitHubIcon) {
250+
JButton btnG = createTransparentButton(
251+
ImageResource.get("github.png"),
252+
new Dimension(XDMUtils.getScaledInt(30),
253+
XDMUtils.getScaledInt(30)),
254+
actGitHub);
255+
btnG.setToolTipText("GitHub");
256+
// btn.setRolloverIcon(ImageResource.get("max_btn_r.png"));
257+
hBox.add(btnG);
258+
}
259+
235260
if (showTwitterIcon) {
236-
JButton btnT = createTransparentButton(ImageResource.get("twitter.png"),
237-
new Dimension(XDMUtils.getScaledInt(30), XDMUtils.getScaledInt(30)), actTwitter);
261+
JButton btnT = createTransparentButton(
262+
ImageResource.get("twitter.png"),
263+
new Dimension(XDMUtils.getScaledInt(30),
264+
XDMUtils.getScaledInt(30)),
265+
actTwitter);
238266
btnT.setToolTipText(StringResource.get("LBL_TWITTER_PAGE"));
239267
// btn.setRolloverIcon(ImageResource.get("max_btn_r.png"));
240268
hBox.add(btnT);
241269
}
242270

243271
if (showFBIcon) {
244-
JButton btnF = createTransparentButton(ImageResource.get("facebook.png"),
245-
new Dimension(XDMUtils.getScaledInt(30), XDMUtils.getScaledInt(30)), actFb);
272+
JButton btnF = createTransparentButton(
273+
ImageResource.get("facebook.png"),
274+
new Dimension(XDMUtils.getScaledInt(30),
275+
XDMUtils.getScaledInt(30)),
276+
actFb);
246277
btnF.setToolTipText(StringResource.get("LBL_LIKE_ON_FB"));
247278
// btn.setRolloverIcon(ImageResource.get("max_btn_r.png"));
248279
hBox.add(btnF);
249280
}
250281

251282
if (minimizeBox) {
252-
JButton btn = createTransparentButton(ImageResource.get("title_min.png"),
253-
new Dimension(XDMUtils.getScaledInt(30), XDMUtils.getScaledInt(30)), actMin);
283+
JButton btn = createTransparentButton(
284+
ImageResource.get("title_min.png"),
285+
new Dimension(XDMUtils.getScaledInt(30),
286+
XDMUtils.getScaledInt(30)),
287+
actMin);
254288
// btn.setRolloverIcon(ImageResource.get("min_btn_r.png"));
255289
hBox.add(btn);
256290
}
257291

258292
if (maximizeBox) {
259-
JButton btn = createTransparentButton(ImageResource.get("title_max.png"),
260-
new Dimension(XDMUtils.getScaledInt(30), XDMUtils.getScaledInt(30)), actMax);
293+
JButton btn = createTransparentButton(
294+
ImageResource.get("title_max.png"),
295+
new Dimension(XDMUtils.getScaledInt(30),
296+
XDMUtils.getScaledInt(30)),
297+
actMax);
261298
// btn.setRolloverIcon(ImageResource.get("max_btn_r.png"));
262299
hBox.add(btn);
263300
}
264301

265-
JButton btn = createTransparentButton(ImageResource.get("title_close.png"),
266-
new Dimension(XDMUtils.getScaledInt(30), XDMUtils.getScaledInt(30)), actClose);
302+
JButton btn = createTransparentButton(
303+
ImageResource.get("title_close.png"),
304+
new Dimension(XDMUtils.getScaledInt(30),
305+
XDMUtils.getScaledInt(30)),
306+
actClose);
267307
// btn.setRolloverIcon(ImageResource.get("close_btn_r.png"));
268308
hBox.add(btn);
269309

@@ -275,23 +315,26 @@ protected void registerTitlePanel(JPanel panel) {
275315

276316
ActionListener actClose = new ActionListener() {
277317
public void actionPerformed(ActionEvent action) {
278-
XDMFrame.this.dispatchEvent(new WindowEvent(XDMFrame.this, WindowEvent.WINDOW_CLOSING));
318+
XDMFrame.this.dispatchEvent(
319+
new WindowEvent(XDMFrame.this, WindowEvent.WINDOW_CLOSING));
279320
};
280321
};
281322

282323
ActionListener actMax = new ActionListener() {
283324
public void actionPerformed(ActionEvent action) {
284-
XDMFrame.this
285-
.setMaximizedBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());
286-
XDMFrame.this.setExtendedState(
287-
(XDMFrame.this.getExtendedState() & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH ? JFrame.NORMAL
325+
XDMFrame.this.setMaximizedBounds(GraphicsEnvironment
326+
.getLocalGraphicsEnvironment().getMaximumWindowBounds());
327+
XDMFrame.this.setExtendedState((XDMFrame.this.getExtendedState()
328+
& JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH
329+
? JFrame.NORMAL
288330
: JFrame.MAXIMIZED_BOTH);
289331
};
290332
};
291333

292334
ActionListener actMin = new ActionListener() {
293335
public void actionPerformed(ActionEvent action) {
294-
XDMFrame.this.setExtendedState(XDMFrame.this.getExtendedState() | JFrame.ICONIFIED);
336+
XDMFrame.this.setExtendedState(
337+
XDMFrame.this.getExtendedState() | JFrame.ICONIFIED);
295338
};
296339
};
297340

@@ -312,6 +355,14 @@ public void actionPerformed(ActionEvent e) {
312355
XDMUtils.browseURL(fbUrl);
313356
}
314357
}
358+
}, actGitHub = new ActionListener() {
359+
360+
@Override
361+
public void actionPerformed(ActionEvent e) {
362+
if (gitHubUrl != null) {
363+
XDMUtils.browseURL(gitHubUrl);
364+
}
365+
}
315366
};
316367

317368
class GripMouseAdapter extends MouseAdapter {
@@ -335,7 +386,8 @@ public void mouseExited(MouseEvent me) {
335386

336387
}
337388

338-
Cursor curDefault, curNResize, curEResize, curWResize, curSResize, curSEResize, curSWResize;
389+
Cursor curDefault, curNResize, curEResize, curWResize, curSResize,
390+
curSEResize, curSWResize;
339391

340392
private void createCursors() {
341393
curDefault = new Cursor(Cursor.DEFAULT_CURSOR);
@@ -345,7 +397,8 @@ private void createCursors() {
345397
curSResize = new Cursor(Cursor.S_RESIZE_CURSOR);
346398
}
347399

348-
JButton createTransparentButton(ImageIcon icon, Dimension d, ActionListener actionListener) {
400+
JButton createTransparentButton(ImageIcon icon, Dimension d,
401+
ActionListener actionListener) {
349402
CustomButton btn = new CustomButton(icon);
350403
btn.setBackground(ColorResource.getTitleColor());
351404
btn.setBorderPainted(false);
@@ -427,7 +480,8 @@ public void hideDialog(JComponent component) {
427480
private synchronized void startModal(Component comp) {
428481
try {
429482
if (SwingUtilities.isEventDispatchThread()) {
430-
EventQueue theQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
483+
EventQueue theQueue = Toolkit.getDefaultToolkit()
484+
.getSystemEventQueue();
431485
while (comp.isVisible()) {
432486
AWTEvent event = theQueue.getNextEvent();
433487
Object source = event.getSource();
572 Bytes
Loading
839 Bytes
Loading
1.13 KB
Loading

0 commit comments

Comments
 (0)