format code

This commit is contained in:
2014-11-16 15:30:27 +01:00
parent 4246b92e85
commit 6d3974db53
30 changed files with 1484 additions and 1490 deletions
@@ -1430,7 +1430,7 @@ public class CommandLineArgumentParser {
try {
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false));
} catch (ActionParseException ex) {
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", "" + ex.line));
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)));
System.exit(1);
}
}
@@ -1444,10 +1444,10 @@ public class CommandLineArgumentParser {
try {
src.setActions(par.actionsFromString(as));
} catch (ActionParseException ex) {
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", "" + ex.line));
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)));
System.exit(1);
} catch (CompilationException ex) {
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", "" + ex.line));
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)));
System.exit(1);
}
src.setModified();
@@ -1486,7 +1486,7 @@ public class CommandLineArgumentParser {
//acode.getBytes(abc.bodies.get(bodyIndex).getCodeBytes());
abc.bodies.get(bodyIndex).setCode(acode);
} catch (AVM2ParseException ex) {
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", "" + ex.line));
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)));
System.exit(1);
}
}
@@ -1509,10 +1509,10 @@ public class CommandLineArgumentParser {
try {
pack.abc.replaceSciptPack(pack, as);
} catch (AVM2ParseException ex) {
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", "" + ex.line));
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)));
System.exit(1);
} catch (CompilationException ex) {
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", "" + ex.line));
System.err.println("%error% on line %line%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)));
System.exit(1);
}
}
@@ -72,7 +72,7 @@ public class ContextMenuTools {
String exeName = "ffdec.exe";
if (add) {
if (add) {
return addToContextMenu(add, fromCommandLine, exeName);
} else {
// remove both 32 and 64 bit references
@@ -324,9 +324,9 @@ public class FontEmbedDialog extends AppDialog implements ActionListener {
}
rangeSamples[i].setText(sample);
rangeSamples[i].setFont(f);
rangeCheckboxes[i].setText(translate("range.description").replace("%available%", "" + avail).replace("%name%", rangeNames[i]).replace("%total%", "" + codes.length));
rangeCheckboxes[i].setText(translate("range.description").replace("%available%", Integer.toString(avail)).replace("%name%", rangeNames[i]).replace("%total%", Integer.toString(codes.length)));
}
allCheckbox.setText(translate("allcharacters").replace("%available%", "" + allChars.size()));
allCheckbox.setText(translate("allcharacters").replace("%available%", Integer.toString(allChars.size())));
individialSample.setFont(f);
updateIndividual();
}
@@ -190,9 +190,9 @@ public class FontPanel extends javax.swing.JPanel {
fontIsBoldCheckBox.setSelected(ft.isBold());
fontIsItalicCheckBox.setSelected(ft.isItalic());
fontDescentLabel.setText(ft.getDescent() == -1 ? translate("value.unknown") : "" + ft.getDescent());
fontAscentLabel.setText(ft.getAscent() == -1 ? translate("value.unknown") : "" + ft.getAscent());
fontLeadingLabel.setText(ft.getLeading() == -1 ? translate("value.unknown") : "" + ft.getLeading());
fontDescentLabel.setText(ft.getDescent() == -1 ? translate("value.unknown") : Integer.toString(ft.getDescent()));
fontAscentLabel.setText(ft.getAscent() == -1 ? translate("value.unknown") : Integer.toString(ft.getAscent()));
fontLeadingLabel.setText(ft.getLeading() == -1 ? translate("value.unknown") : Integer.toString(ft.getLeading()));
String chars = ft.getCharacters(swf.tags);
fontCharactersTextArea.setText(chars);
setAllowSave(false);
@@ -79,21 +79,21 @@ public class HeaderInfoPanel extends JPanel {
compressionLabel.setText(AppStrings.translate("header.compression.none"));
break;
}
versionLabel.setText("" + swf.version);
versionLabel.setText(Integer.toString(swf.version));
gfxLabel.setText(swf.gfx ? AppStrings.translate("yes") : AppStrings.translate("no"));
fileSizeLabel.setText("" + swf.fileSize);
frameRateLabel.setText("" + swf.frameRate);
fileSizeLabel.setText(Long.toString(swf.fileSize));
frameRateLabel.setText(Integer.toString(swf.frameRate));
frameCountLabel.setText("" + swf.frameCount);
displayRectTwipsLabel.setText(AppStrings.translate("header.displayrect.value.twips")
.replace("%xmin%", "" + swf.displayRect.Xmin)
.replace("%ymin%", "" + swf.displayRect.Ymin)
.replace("%xmax%", "" + swf.displayRect.Xmax)
.replace("%ymax%", "" + swf.displayRect.Ymax));
.replace("%xmin%", Integer.toString(swf.displayRect.Xmin))
.replace("%ymin%", Integer.toString(swf.displayRect.Ymin))
.replace("%xmax%", Integer.toString(swf.displayRect.Xmax))
.replace("%ymax%", Integer.toString(swf.displayRect.Ymax)));
displayRectPixelsLabel.setText(AppStrings.translate("header.displayrect.value.pixels")
.replace("%xmin%", "" + fmtDouble(swf.displayRect.Xmin / SWF.unitDivisor))
.replace("%ymin%", "" + fmtDouble(swf.displayRect.Ymin / SWF.unitDivisor))
.replace("%xmax%", "" + fmtDouble(swf.displayRect.Xmax / SWF.unitDivisor))
.replace("%ymax%", "" + fmtDouble(swf.displayRect.Ymax / SWF.unitDivisor)));
.replace("%xmin%", fmtDouble(swf.displayRect.Xmin / SWF.unitDivisor))
.replace("%ymin%", fmtDouble(swf.displayRect.Ymin / SWF.unitDivisor))
.replace("%xmax%", fmtDouble(swf.displayRect.Xmax / SWF.unitDivisor))
.replace("%ymax%", fmtDouble(swf.displayRect.Ymax / SWF.unitDivisor)));
}
private String fmtDouble(double d) {
@@ -69,7 +69,7 @@ public class LicenseUpdater {
int defaultStartYear = 2010;
int defaultFinalYear = 2014;
String defaultAuthor = "JPEXS";
String defaultYearStr = "" + defaultStartYear;
String defaultYearStr = Integer.toString(defaultStartYear);
if (defaultFinalYear != defaultStartYear) {
defaultYearStr += "-" + defaultFinalYear;
}
@@ -116,9 +116,9 @@ public class LicenseUpdater {
author = mAuthor.group(3).trim();
int startYear = Integer.parseInt(mAuthor.group(1).trim());
if (startYear == defaultFinalYear) {
yearStr = "" + startYear;
yearStr = Integer.toString(startYear);
} else {
yearStr = "" + startYear + "-" + defaultFinalYear;
yearStr = Integer.toString(startYear) + "-" + defaultFinalYear;
}
if (!author.equals(defaultAuthor)) {
System.out.println("Detected nodefault author:" + author + " in " + f.getAbsolutePath());
@@ -141,7 +141,7 @@ public class LoadFromMemoryFrame extends AppFrame implements ActionListener {
is = new ReReadableInputStream(new LimitedInputStream(is, limit));
if (swf.fileSize > 0 && swf.version > 0 && !swf.tags.isEmpty() && swf.version < 25/*Needs to be fixed when SWF versions reaches this value*/) {
SwfInMemory s = new SwfInMemory(is, swf.version, swf.fileSize, proc);
String p = translate("swfitem").replace("%version%", "" + swf.version).replace("%size%", "" + swf.fileSize);
String p = translate("swfitem").replace("%version%", Integer.toString(swf.version)).replace("%size%", Long.toString(swf.fileSize));
publish(s);
swfStreams.add(s);
}
+9 -9
View File
@@ -1250,15 +1250,15 @@ public class Main {
if (Configuration.checkForUpdatesAuto.get()) {
Calendar lastUpdatesCheckDate = Configuration.lastUpdatesCheckDate.get();
if ((lastUpdatesCheckDate == null) || (lastUpdatesCheckDate.getTime().getTime() < Calendar.getInstance().getTime().getTime() - Configuration.checkForUpdatesDelay.get())) {
new SwingWorker(){
new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
protected Object doInBackground() throws Exception {
checkForUpdates();
return null;
}
}
}.execute();
System.out.println("finished");
}
}
}
@@ -1293,12 +1293,12 @@ public class Main {
Socket sock = new Socket("www.free-decompiler.com", 80);
OutputStream os = sock.getOutputStream();
String currentLoc = Configuration.locale.get("en");
os.write(("GET /flash/update.html?action=check&currentVersion=" + URLEncoder.encode(currentVersion, "UTF-8")
os.write(("GET /flash/update.html?action=check&currentVersion=" + URLEncoder.encode(currentVersion, "UTF-8")
+ "&currentRevision=" + URLEncoder.encode(ApplicationInfo.revision, "UTF-8")
+ "&currentVersionMajor=" + URLEncoder.encode(""+ApplicationInfo.version_major, "UTF-8")
+ "&currentVersionMinor=" + URLEncoder.encode(""+ApplicationInfo.version_minor, "UTF-8")
+ "&currentVersionRelease=" + URLEncoder.encode(""+ApplicationInfo.version_release, "UTF-8")
+ "&currentVersionBuild=" + URLEncoder.encode(""+ApplicationInfo.version_build, "UTF-8")
+ "&currentVersionMajor=" + URLEncoder.encode("" + ApplicationInfo.version_major, "UTF-8")
+ "&currentVersionMinor=" + URLEncoder.encode("" + ApplicationInfo.version_minor, "UTF-8")
+ "&currentVersionRelease=" + URLEncoder.encode("" + ApplicationInfo.version_release, "UTF-8")
+ "&currentVersionBuild=" + URLEncoder.encode("" + ApplicationInfo.version_build, "UTF-8")
+ "&currentNightly=" + (ApplicationInfo.nightly ? "1" : "0") + " HTTP/1.1\r\n"
+ "Host: www.free-decompiler.com\r\n"
+ "X-Accept-Versions: " + acceptVersions + "\r\n"
@@ -933,7 +933,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
}
}
}
View.showMessageDialog(null, translate("rename.finished.multiname").replace("%count%", "" + mulCount));
View.showMessageDialog(null, translate("rename.finished.multiname").replace("%count%", Integer.toString(mulCount)));
if (abcPanel != null) {
abcPanel.reload();
}
@@ -1117,7 +1117,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
public List<SWFList> getSwfs() {
return swfs;
}
public SWFList getCurrentSwfList() {
SWF swf = getCurrentSwf();
if (swf == null) {
@@ -1774,7 +1774,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
try {
int cnt = get();
Main.stopWork();
View.showMessageDialog(null, translate("message.rename.renamed").replace("%count%", "" + cnt));
View.showMessageDialog(null, translate("message.rename.renamed").replace("%count%", Integer.toString(cnt)));
swf.assignClassesToSymbols();
clearCache();
if (abcPanel != null) {
@@ -1880,11 +1880,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
if (tagTree.getModel() != null) {
View.refreshTree(tagTree, new TagTreeModel(swfs, Configuration.tagTreeShowEmptyFolders.get()));
}
if (dumpTree.getModel() != null) {
View.refreshTree(dumpTree, new DumpTreeModel(swfs));
}
if (treeItem != null) {
setTagTreeSelectedNode(treeItem);
}
@@ -1927,7 +1927,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
return true;
}
} catch (TextParseException ex) {
View.showMessageDialog(null, translate("error.text.invalid").replace("%text%", ex.text).replace("%line%", "" + ex.line), translate("error"), JOptionPane.ERROR_MESSAGE);
View.showMessageDialog(null, translate("error.text.invalid").replace("%text%", ex.text).replace("%line%", Long.toString(ex.line)), translate("error"), JOptionPane.ERROR_MESSAGE);
}
return false;
}
@@ -2043,7 +2043,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private File showImportFileChooser(String filter) {
String[] filterArray = filter.split("\\|");
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
boolean first = true;
@@ -2089,10 +2089,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) {
return fc.getSelectedFile();
}
return null;
}
private int splitPos = 0;
public void showDetail(String card) {
@@ -2168,8 +2168,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private int getCurrentView() {
return Configuration.dumpView.get() ? VIEW_DUMP : VIEW_RESOURCES;
}
}
public void setTreeModel(int view) {
switch (view) {
case VIEW_DUMP:
@@ -2184,7 +2184,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
break;
}
}
public boolean showView(int view) {
CardLayout cl = (CardLayout) (contentPanel.getLayout());
@@ -2247,7 +2247,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
public void loadFromBinaryTag(final DefineBinaryDataTag binaryDataTag) {
loadFromBinaryTag(Arrays.asList(binaryDataTag));
}
public void loadFromBinaryTag(final List<DefineBinaryDataTag> binaryDataTags) {
if (Main.loadingDialog == null || Main.loadingDialog.getOwner() == null) {
@@ -45,7 +45,7 @@ public class SwfInMemory {
@Override
public String toString() {
String p = translate("swfitem").replace("%version%", "" + version).replace("%size%", "" + fileSize);
String p = translate("swfitem").replace("%version%", Integer.toString(version)).replace("%size%", Long.toString(fileSize));
return p;
}
}
+1 -1
View File
@@ -521,7 +521,7 @@ public class View {
expandTreeNodesRecursive(tree, parent, expand);
tree.setUI(ui);
}
private static void expandTreeNodesRecursive(JTree tree, TreePath parent, boolean expand) {
TreeModel model = tree.getModel();
@@ -863,12 +863,12 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
abc.script_info.get(oldIndex).delete(abc, false);
decompiledTextArea.gotoLine((int) ex.line);
decompiledTextArea.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (CompilationException ex) {
abc.script_info.get(oldIndex).delete(abc, false);
decompiledTextArea.gotoLine((int) ex.line);
decompiledTextArea.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (IOException | InterruptedException ex) {
//ignore
}
@@ -74,21 +74,21 @@ public class ConstantsListModel implements ListModel {
public Object getElementAt(int index) {
switch (type) {
case TYPE_UINT:
return "" + (index + 1) + ":" + constants.getUInt(index + 1);
return (index + 1) + ":" + constants.getUInt(index + 1);
case TYPE_INT:
return "" + (index + 1) + ":" + constants.getInt(index + 1);
return (index + 1) + ":" + constants.getInt(index + 1);
case TYPE_DOUBLE:
return "" + (index + 1) + ":" + constants.getDouble(index + 1);
return (index + 1) + ":" + constants.getDouble(index + 1);
case TYPE_DECIMAL:
return "" + (index + 1) + ":" + constants.getDecimal(index + 1);
return (index + 1) + ":" + constants.getDecimal(index + 1);
case TYPE_STRING:
return "" + (index + 1) + ":" + Helper.escapeString(constants.getString(index + 1));
return (index + 1) + ":" + Helper.escapeString(constants.getString(index + 1));
case TYPE_NAMESPACE:
return "" + (index + 1) + ":" + constants.getNamespace(index + 1).getNameWithKind(constants);
return (index + 1) + ":" + constants.getNamespace(index + 1).getNameWithKind(constants);
case TYPE_NAMESPACESET:
return "" + (index + 1) + ":" + constants.getNamespaceSet(index + 1).toString(constants);
return (index + 1) + ":" + constants.getNamespaceSet(index + 1).toString(constants);
case TYPE_MULTINAME:
return "" + (index + 1) + ":" + constants.getMultiname(index + 1).toString(constants, new ArrayList<String>());
return (index + 1) + ":" + constants.getMultiname(index + 1).toString(constants, new ArrayList<String>());
}
return null;
}
@@ -159,7 +159,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
return;
}
for (Highlighting h : traitHighlights) {
if (h.getProperties().index == lastTraitIndex) {
if (h.getProperties().index == lastTraitIndex) {
Highlighting h2 = Highlighting.searchOffset(highlights, offset, h.startPos, h.startPos + h.len);
if (h2 != null) {
ignoreCarret = true;
@@ -30,16 +30,16 @@ public class DialogMissingSymbolHandler implements MissingSymbolHandler {
@Override
public boolean missingInt(long value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.integer").replace("%value%", "" + value), AppStrings.translate("message.constant.new.integer.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.integer").replace("%value%", Long.toString(value)), AppStrings.translate("message.constant.new.integer.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
@Override
public boolean missingUInt(long value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.unsignedinteger").replace("%value%", "" + value), AppStrings.translate("message.constant.new.unsignedinteger.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.unsignedinteger").replace("%value%", Long.toString(value)), AppStrings.translate("message.constant.new.unsignedinteger.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
@Override
public boolean missingDouble(double value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.double").replace("%value%", "" + value), AppStrings.translate("message.constant.new.double.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.double").replace("%value%", Double.toString(value)), AppStrings.translate("message.constant.new.double.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
}
@@ -100,7 +100,7 @@ public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail {
writer.appendNoHilight(" ");
writer.hilightSpecial(trait.isConst() ? "const" : "slot", HighlightSpecialType.TRAIT_TYPE);
writer.appendNoHilight(" slotid ");
writer.hilightSpecial("" + trait.slot_id, HighlightSpecialType.SLOT_ID);
writer.hilightSpecial(Integer.toString(trait.slot_id), HighlightSpecialType.SLOT_ID);
writer.appendNoHilight(" type ");
writer.hilightSpecial(abc.constants.multinameToString(trait.type_index), HighlightSpecialType.TRAIT_TYPE_NAME);
writer.appendNoHilight(" value ");
@@ -1,155 +1,155 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.abc.tablemodels;
import com.jpexs.decompiler.flash.abc.ABC;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;
public class DoubleTableModel implements TableModel {
private final ABC abc;
private static final String[] columnNames = new String[]{"Index", "Value"};
private static final Class[] classes = new Class[]{Long.class, String.class};
public DoubleTableModel(ABC abc) {
this.abc = abc;
}
/**
* Returns the number of rows in the model. A <code>JTable</code> uses this
* method to determine how many rows it should display. This method should
* be quick, as it is called frequently during rendering.
*
* @return the number of rows in the model
* @see #getColumnCount
*/
@Override
public int getRowCount() {
if (abc == null) {
return 0;
}
return abc.constants.getDoubleCount();
}
/**
* Returns the number of columns in the model. A <code>JTable</code> uses
* this method to determine how many columns it should create and display by
* default.
*
* @return the number of columns in the model
* @see #getRowCount
*/
@Override
public int getColumnCount() {
return 2;
}
/**
* Returns the name of the column at <code>columnIndex</code>. This is used
* to initialize the table's column header name. Note: this name does not
* need to be unique; two columns in a table can have the same name.
*
* @param columnIndex the index of the column
* @return the name of the column
*/
@Override
public String getColumnName(int columnIndex) {
return columnNames[columnIndex];
}
/**
* Returns the most specific superclass for all the cell values in the
* column. This is used by the <code>JTable</code> to set up a default
* renderer and editor for the column.
*
* @param columnIndex the index of the column
* @return the common ancestor class of the object values in the model.
*/
@Override
public Class<?> getColumnClass(int columnIndex) {
return classes[columnIndex];
}
/**
* Returns true if the cell at <code>rowIndex</code> and
* <code>columnIndex</code> is editable. Otherwise, <code>setValueAt</code>
* on the cell will not change the value of that cell.
*
* @param rowIndex the row whose value to be queried
* @param columnIndex the column whose value to be queried
* @return true if the cell is editable
* @see #setValueAt
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
/**
* Returns the value for the cell at <code>columnIndex</code> and
* <code>rowIndex</code>.
*
* @param rowIndex the row whose value is to be queried
* @param columnIndex the column whose value is to be queried
* @return the value Object at the specified cell
*/
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return rowIndex;
} else if (Double.isNaN(abc.constants.getDouble(rowIndex))) {
return "NaN";
} else {
return "" + abc.constants.getDouble(rowIndex);
}
}
/**
* Sets the value in the cell at <code>columnIndex</code> and
* <code>rowIndex</code> to <code>aValue</code>.
*
* @param aValue the new value
* @param rowIndex the row whose value is to be changed
* @param columnIndex the column whose value is to be changed
* @see #getValueAt
* @see #isCellEditable
*/
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
}
/**
* Adds a listener to the list that is notified each time a change to the
* data model occurs.
*
* @param l the TableModelListener
*/
@Override
public void addTableModelListener(TableModelListener l) {
}
/**
* Removes a listener from the list that is notified each time a change to
* the data model occurs.
*
* @param l the TableModelListener
*/
@Override
public void removeTableModelListener(TableModelListener l) {
}
}
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.abc.tablemodels;
import com.jpexs.decompiler.flash.abc.ABC;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;
public class DoubleTableModel implements TableModel {
private final ABC abc;
private static final String[] columnNames = new String[]{"Index", "Value"};
private static final Class[] classes = new Class[]{Long.class, String.class};
public DoubleTableModel(ABC abc) {
this.abc = abc;
}
/**
* Returns the number of rows in the model. A <code>JTable</code> uses this
* method to determine how many rows it should display. This method should
* be quick, as it is called frequently during rendering.
*
* @return the number of rows in the model
* @see #getColumnCount
*/
@Override
public int getRowCount() {
if (abc == null) {
return 0;
}
return abc.constants.getDoubleCount();
}
/**
* Returns the number of columns in the model. A <code>JTable</code> uses
* this method to determine how many columns it should create and display by
* default.
*
* @return the number of columns in the model
* @see #getRowCount
*/
@Override
public int getColumnCount() {
return 2;
}
/**
* Returns the name of the column at <code>columnIndex</code>. This is used
* to initialize the table's column header name. Note: this name does not
* need to be unique; two columns in a table can have the same name.
*
* @param columnIndex the index of the column
* @return the name of the column
*/
@Override
public String getColumnName(int columnIndex) {
return columnNames[columnIndex];
}
/**
* Returns the most specific superclass for all the cell values in the
* column. This is used by the <code>JTable</code> to set up a default
* renderer and editor for the column.
*
* @param columnIndex the index of the column
* @return the common ancestor class of the object values in the model.
*/
@Override
public Class<?> getColumnClass(int columnIndex) {
return classes[columnIndex];
}
/**
* Returns true if the cell at <code>rowIndex</code> and
* <code>columnIndex</code> is editable. Otherwise, <code>setValueAt</code>
* on the cell will not change the value of that cell.
*
* @param rowIndex the row whose value to be queried
* @param columnIndex the column whose value to be queried
* @return true if the cell is editable
* @see #setValueAt
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
/**
* Returns the value for the cell at <code>columnIndex</code> and
* <code>rowIndex</code>.
*
* @param rowIndex the row whose value is to be queried
* @param columnIndex the column whose value is to be queried
* @return the value Object at the specified cell
*/
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return rowIndex;
} else if (Double.isNaN(abc.constants.getDouble(rowIndex))) {
return "NaN";
} else {
return Double.toString(abc.constants.getDouble(rowIndex));
}
}
/**
* Sets the value in the cell at <code>columnIndex</code> and
* <code>rowIndex</code> to <code>aValue</code>.
*
* @param aValue the new value
* @param rowIndex the row whose value is to be changed
* @param columnIndex the column whose value is to be changed
* @see #getValueAt
* @see #isCellEditable
*/
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
}
/**
* Adds a listener to the list that is notified each time a change to the
* data model occurs.
*
* @param l the TableModelListener
*/
@Override
public void addTableModelListener(TableModelListener l) {
}
/**
* Removes a listener from the list that is notified each time a change to
* the data model occurs.
*
* @param l the TableModelListener
*/
@Override
public void removeTableModelListener(TableModelListener l) {
}
}
@@ -777,7 +777,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
} catch (ActionParseException ex) {
editor.gotoLine((int) ex.line);
editor.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
break;
case ACTION_EDIT_DECOMPILED:
@@ -800,9 +800,9 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
} catch (IOException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex);
} catch (ActionParseException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (CompilationException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
break;
}
@@ -75,7 +75,7 @@ public class Debugger {
@Override
public void run() {
String clientName = "" + id;
String clientName = Integer.toString(id);
try (InputStream is = s.getInputStream()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -191,11 +191,11 @@ public class PlayerControls extends JPanel implements ActionListener {
s %= 60;
long h = m / 60;
m %= 60;
return "" + (h > 0 ? h + ":" : "") + pad(m) + ":" + pad(s) + "." + pad(ms / 10);
return (h > 0 ? h + ":" : "") + pad(m) + ":" + pad(s) + "." + pad(ms / 10);
}
private String pad(long t) {
String ret = "" + t;
String ret = Long.toString(t);
while (ret.length() < 2) {
ret = "0" + ret;
}
@@ -268,12 +268,12 @@ public class PlayerControls extends JPanel implements ActionListener {
private void updateZoom() {
double pctzoom = roundZoom(realZoom * 100, 3);
String r = "" + pctzoom;
String r = Double.toString(pctzoom);
double zoom = pctzoom / 100.0;
if (r.endsWith(".0")) {
r = r.substring(0, r.length() - 2);
}
percentLabel.setText("" + r + "%");
percentLabel.setText(r + "%");
display.zoom(zoom);
}
@@ -346,7 +346,7 @@ public class PlayerControls extends JPanel implements ActionListener {
@Override
public DataFlavor[] getTransferDataFlavors() {
DataFlavor[] flavors = new DataFlavor[1];
flavors[ 0] = DataFlavor.imageFlavor;
flavors[0] = DataFlavor.imageFlavor;
return flavors;
}
@@ -354,7 +354,7 @@ public class PlayerControls extends JPanel implements ActionListener {
public boolean isDataFlavorSupported(DataFlavor flavor) {
DataFlavor[] flavors = getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
if (flavor.equals(flavors[ i])) {
if (flavor.equals(flavors[i])) {
return true;
}
}
@@ -97,7 +97,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
* @param port Port number
*/
public void setPort(int port) {
portField.setText("" + port);
portField.setText(Integer.toString(port));
}
/**
@@ -218,7 +218,7 @@ public class TagTree extends JTree {
setBackground(Color.white);
setRowHeight(16);
setLargeModel(true);
TreeUI treeUI = new BasicTreeUI() {
{
setHashColor(Color.gray);
@@ -151,7 +151,7 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
if (paths == null || paths.length == 0) {
return;
}
List<TreeItem> li = new ArrayList<>();
for (TreePath treePath : paths) {
TreeItem item = (TreeItem) treePath.getLastPathComponent();
@@ -164,15 +164,15 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
}
});
}
public void update(List<TreeItem> items) {
if (items.isEmpty()) {
return;
}
final List<SWFList> swfs = mainPanel.getSwfs();
boolean allSelectedIsTagOrFrame = true;
for (TreeItem item : items) {
if (!(item instanceof Tag) && !(item instanceof Frame)) {
@@ -197,8 +197,8 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
} else if (item instanceof SWF) {
SWF swf = (SWF) item;
// Do not allow to close SWF in bundle
if (swf.swfList != null &&swf.swfList.isBundle) {
allSelectedIsSwf = false;
if (swf.swfList != null && swf.swfList.isBundle) {
allSelectedIsSwf = false;
}
}
}
@@ -217,12 +217,12 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
final TreeItem firstItem = items.get(0);
boolean singleSelect = items.size() == 1;
if (singleSelect) {
// replace
if (firstItem instanceof ImageTag && ((ImageTag) firstItem).importSupported()) {
replaceMenuItem.setVisible(true);
}
}
if (firstItem instanceof ShapeTag) {
replaceMenuItem.setVisible(true);
@@ -314,22 +314,22 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
rawEditMenuItem.setVisible(firstItem instanceof Tag);
}
}
if (allSelectedIsBinaryData) {
boolean anyInnerSwf = false;
for (TreeItem item : items) {
DefineBinaryDataTag binary = (DefineBinaryDataTag) item;
// inner swf is not loaded yet
if (binary.innerSwf == null && binary.isSwfData()) {
anyInnerSwf = true;
}
}
openSWFInsideTagMenuItem.setVisible(anyInnerSwf);
}
}
@Override
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
@@ -342,7 +342,7 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener {
binaryDatas.add((DefineBinaryDataTag) item);
}
}
mainPanel.loadFromBinaryTag(binaryDatas);
}
break;
@@ -1,72 +1,72 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.timeline;
import com.jpexs.decompiler.flash.timeline.Timeline;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.JPanel;
/**
*
* @author JPEXS
*/
public class TimelineDepthPanel extends JPanel {
private final int maxDepth;
public static final int padding = 5;
public static final float fontSize = 10.0f;
private int scrollOffset = 0;
public static final Color borderColor = Color.lightGray;
public static final Color fontColor = Color.black;
public TimelineDepthPanel(Timeline timeline) {
maxDepth = timeline.getMaxDepth();
String maxDepthStr = "" + maxDepth;
setFont(getFont().deriveFont(fontSize));
int maxDepthW = getFontMetrics(getFont()).stringWidth(maxDepthStr);
Dimension dim = new Dimension(maxDepthW + 2 * padding, Integer.MAX_VALUE);
setSize(dim);
setPreferredSize(dim);
}
public void scroll(int offset) {
this.scrollOffset = offset;
repaint();
}
@Override
protected void paintComponent(Graphics g) {
Rectangle clip = g.getClipBounds();
int yofs = TimelinePanel.FRAME_HEIGHT - (scrollOffset % TimelinePanel.FRAME_HEIGHT);
int start_d = (scrollOffset + clip.y) / TimelinePanel.FRAME_HEIGHT;
int end_d = (scrollOffset + clip.y + clip.height) / TimelinePanel.FRAME_HEIGHT;
int d_count = end_d - start_d;
g.setColor(TimelinePanel.backgroundColor);
g.fillRect(0, 0, getWidth(), getHeight());
for (int d = 0; d < d_count; d++) {
g.setColor(borderColor);
g.drawLine(0, yofs + d * TimelinePanel.FRAME_HEIGHT + 1, getWidth(), yofs + d * TimelinePanel.FRAME_HEIGHT + 1);
int curr_d = start_d + d;
g.setColor(fontColor);
g.drawString("" + (start_d + d == 0 ? "a" : curr_d), padding, yofs + d * TimelinePanel.FRAME_HEIGHT - padding);
}
}
}
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.timeline;
import com.jpexs.decompiler.flash.timeline.Timeline;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.JPanel;
/**
*
* @author JPEXS
*/
public class TimelineDepthPanel extends JPanel {
private final int maxDepth;
public static final int padding = 5;
public static final float fontSize = 10.0f;
private int scrollOffset = 0;
public static final Color borderColor = Color.lightGray;
public static final Color fontColor = Color.black;
public TimelineDepthPanel(Timeline timeline) {
maxDepth = timeline.getMaxDepth();
String maxDepthStr = Integer.toString(maxDepth);
setFont(getFont().deriveFont(fontSize));
int maxDepthW = getFontMetrics(getFont()).stringWidth(maxDepthStr);
Dimension dim = new Dimension(maxDepthW + 2 * padding, Integer.MAX_VALUE);
setSize(dim);
setPreferredSize(dim);
}
public void scroll(int offset) {
this.scrollOffset = offset;
repaint();
}
@Override
protected void paintComponent(Graphics g) {
Rectangle clip = g.getClipBounds();
int yofs = TimelinePanel.FRAME_HEIGHT - (scrollOffset % TimelinePanel.FRAME_HEIGHT);
int start_d = (scrollOffset + clip.y) / TimelinePanel.FRAME_HEIGHT;
int end_d = (scrollOffset + clip.y + clip.height) / TimelinePanel.FRAME_HEIGHT;
int d_count = end_d - start_d;
g.setColor(TimelinePanel.backgroundColor);
g.fillRect(0, 0, getWidth(), getHeight());
for (int d = 0; d < d_count; d++) {
g.setColor(borderColor);
g.drawLine(0, yofs + d * TimelinePanel.FRAME_HEIGHT + 1, getWidth(), yofs + d * TimelinePanel.FRAME_HEIGHT + 1);
int curr_d = start_d + d;
g.setColor(fontColor);
g.drawString(start_d + d == 0 ? "a" : Integer.toString(curr_d), padding, yofs + d * TimelinePanel.FRAME_HEIGHT - padding);
}
}
}
@@ -1,126 +1,126 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.timeline;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
/**
*
* @author JPEXS
*/
public class TimelineTimePanel extends JPanel implements MouseListener {
public static final Color borderColor = Color.black;
public static final int lineLength = 3;
public static final int lineTextSpace = 3;
public static final Color fontColor = Color.black;
public float fontSize = 10.0f;
private int scrollOffset = 0;
private int selectedFrame = -1;
private final List<FrameSelectionListener> listeners = new ArrayList<>();
public TimelineTimePanel() {
Dimension dim = new Dimension(Integer.MAX_VALUE, TimelinePanel.FRAME_HEIGHT);
setSize(dim);
setPreferredSize(dim);
addMouseListener(this);
}
public void addFrameSelectionListener(FrameSelectionListener l) {
listeners.add(l);
}
public void removeFrameSelectionListener(FrameSelectionListener l) {
listeners.remove(l);
}
public void frameSelect(int frame) {
if (selectedFrame == frame) {
return;
}
for (FrameSelectionListener l : listeners) {
l.frameSelected(frame, -1);
}
selectedFrame = frame;
repaint();
}
public void scroll(int offset) {
this.scrollOffset = offset;
repaint();
}
@Override
protected void paintComponent(Graphics g) {
Rectangle clip = g.getClipBounds();
int start_f = (scrollOffset + clip.x) / TimelinePanel.FRAME_WIDTH;
int end_f = (scrollOffset + clip.x + clip.width) / TimelinePanel.FRAME_WIDTH;
g.setColor(TimelinePanel.backgroundColor);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(borderColor);
int xofs = TimelinePanel.FRAME_WIDTH - scrollOffset % TimelinePanel.FRAME_WIDTH - 1;
for (int f = 0; f <= end_f; f++) {
g.drawLine(xofs + f * TimelinePanel.FRAME_WIDTH + 1, TimelinePanel.FRAME_HEIGHT - 1, xofs + f * TimelinePanel.FRAME_WIDTH + 1, TimelinePanel.FRAME_HEIGHT - lineLength);
}
g.setFont(g.getFont().deriveFont(fontSize));
for (int f = 0; f <= end_f; f++) {
int cur_f = start_f + f;
if (selectedFrame == cur_f) {
g.setColor(TimelinePanel.selectedColor);
g.fillRect(xofs + (f - 1) * TimelinePanel.FRAME_WIDTH + 1, 0, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT - 1);
g.setColor(TimelinePanel.selectedBorderColor);
g.drawRect(xofs + (f - 1) * TimelinePanel.FRAME_WIDTH + 1, 0, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT - 1);
}
g.setColor(fontColor);
if ((cur_f + 1) % 5 == 0 || cur_f == 0) {
String timeStr = "" + (cur_f + 1);
int w = g.getFontMetrics().stringWidth(timeStr);
g.drawString(timeStr, xofs + (f - 1) * TimelinePanel.FRAME_WIDTH + TimelinePanel.FRAME_WIDTH / 2 - w / 2, TimelinePanel.FRAME_HEIGHT - lineLength - lineTextSpace);
}
}
}
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
frameSelect((scrollOffset + e.getX()) / TimelinePanel.FRAME_WIDTH);
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
}
/*
* Copyright (C) 2010-2014 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.timeline;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
/**
*
* @author JPEXS
*/
public class TimelineTimePanel extends JPanel implements MouseListener {
public static final Color borderColor = Color.black;
public static final int lineLength = 3;
public static final int lineTextSpace = 3;
public static final Color fontColor = Color.black;
public float fontSize = 10.0f;
private int scrollOffset = 0;
private int selectedFrame = -1;
private final List<FrameSelectionListener> listeners = new ArrayList<>();
public TimelineTimePanel() {
Dimension dim = new Dimension(Integer.MAX_VALUE, TimelinePanel.FRAME_HEIGHT);
setSize(dim);
setPreferredSize(dim);
addMouseListener(this);
}
public void addFrameSelectionListener(FrameSelectionListener l) {
listeners.add(l);
}
public void removeFrameSelectionListener(FrameSelectionListener l) {
listeners.remove(l);
}
public void frameSelect(int frame) {
if (selectedFrame == frame) {
return;
}
for (FrameSelectionListener l : listeners) {
l.frameSelected(frame, -1);
}
selectedFrame = frame;
repaint();
}
public void scroll(int offset) {
this.scrollOffset = offset;
repaint();
}
@Override
protected void paintComponent(Graphics g) {
Rectangle clip = g.getClipBounds();
int start_f = (scrollOffset + clip.x) / TimelinePanel.FRAME_WIDTH;
int end_f = (scrollOffset + clip.x + clip.width) / TimelinePanel.FRAME_WIDTH;
g.setColor(TimelinePanel.backgroundColor);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(borderColor);
int xofs = TimelinePanel.FRAME_WIDTH - scrollOffset % TimelinePanel.FRAME_WIDTH - 1;
for (int f = 0; f <= end_f; f++) {
g.drawLine(xofs + f * TimelinePanel.FRAME_WIDTH + 1, TimelinePanel.FRAME_HEIGHT - 1, xofs + f * TimelinePanel.FRAME_WIDTH + 1, TimelinePanel.FRAME_HEIGHT - lineLength);
}
g.setFont(g.getFont().deriveFont(fontSize));
for (int f = 0; f <= end_f; f++) {
int cur_f = start_f + f;
if (selectedFrame == cur_f) {
g.setColor(TimelinePanel.selectedColor);
g.fillRect(xofs + (f - 1) * TimelinePanel.FRAME_WIDTH + 1, 0, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT - 1);
g.setColor(TimelinePanel.selectedBorderColor);
g.drawRect(xofs + (f - 1) * TimelinePanel.FRAME_WIDTH + 1, 0, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT - 1);
}
g.setColor(fontColor);
if ((cur_f + 1) % 5 == 0 || cur_f == 0) {
String timeStr = Integer.toString(cur_f + 1);
int w = g.getFontMetrics().stringWidth(timeStr);
g.drawString(timeStr, xofs + (f - 1) * TimelinePanel.FRAME_WIDTH + TimelinePanel.FRAME_WIDTH / 2 - w / 2, TimelinePanel.FRAME_HEIGHT - lineLength - lineTextSpace);
}
}
}
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
frameSelect((scrollOffset + e.getX()) / TimelinePanel.FRAME_WIDTH);
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
}