-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mass convert #33
base: devel
Are you sure you want to change the base?
Mass convert #33
Changes from 3 commits
e6e2109
94c6d2c
580502f
aafb628
89fca90
9044e2d
e1f5b09
625dd01
f73159b
22685ba
dc89796
353130c
3830798
1c59c47
ead4b64
60a4921
f5df564
2bc5022
c1a182e
e02c8f5
6bca663
78b74e7
8ed6231
3698122
0075e22
4c8e5e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ NearInfinity.jar | |
/bin | ||
/build | ||
/.settings | ||
.idea | ||
NearInfinity.iml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.infinity.gui; | ||
|
||
import javax.swing.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to avoid wildcard imports. They can unexpectedly stop working in new Java versions, because new classes can be added to the packages. |
||
import javax.swing.table.TableCellRenderer; | ||
import java.awt.*; | ||
|
||
public class ProgressCellRenderer extends JProgressBar implements TableCellRenderer { | ||
|
||
/** | ||
* Creates a JProgressBar with the range 0,100. | ||
*/ | ||
public ProgressCellRenderer(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use consistent code style -- space between braces |
||
super(0, 100); | ||
setValue(0); | ||
setString("0%"); | ||
setStringPainted(true); | ||
} | ||
|
||
public Component getTableCellRendererComponent( | ||
JTable table, | ||
Object value, | ||
boolean isSelected, | ||
boolean hasFocus, | ||
int row, | ||
int column) { | ||
|
||
//value is a percentage e.g. 95% | ||
final String sValue = value.toString(); | ||
int index = sValue.indexOf('%'); | ||
if (index != -1) { | ||
int p = 0; | ||
try{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style again |
||
p = Integer.parseInt(sValue.substring(0, index)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why you need parsing? What type of |
||
} | ||
catch(NumberFormatException e) { | ||
System.out.println("Number Format Exception"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
} | ||
|
||
this.setValue(p); | ||
this.setString(sValue); | ||
} | ||
return this; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There a several files without newline in the end. I think, it is better to have it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a license header as in the other files