Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
4a63f522
Commit
4a63f522
authored
Nov 27, 2013
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui: fix ui tabs handling
parent
c416f77e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
MainWindow.java
jadx-gui/src/main/java/jadx/gui/MainWindow.java
+16
-18
No files found.
jadx-gui/src/main/java/jadx/gui/MainWindow.java
View file @
4a63f522
...
...
@@ -80,7 +80,7 @@ public class MainWindow extends JFrame {
private
JTree
tree
;
private
final
JTabbedPane
tabbedPane
=
new
JTabbedPane
();
private
DefaultTreeModel
treeModel
;
private
Map
<
JClass
,
Integer
>
openTabs
=
new
HashMap
<
JClass
,
Integer
>();
private
Map
<
JClass
,
Component
>
openTabs
=
new
HashMap
<
JClass
,
Component
>();
public
MainWindow
(
JadxWrapper
wrapper
)
{
this
.
wrapper
=
wrapper
;
...
...
@@ -192,27 +192,24 @@ public class MainWindow extends JFrame {
}
private
void
showCode
(
JClass
cls
,
int
line
)
{
JPanel
panel
;
if
(
openTabs
.
containsKey
(
cls
))
{
int
id
=
openTabs
.
get
(
cls
);
panel
=
(
JPanel
)
tabbedPane
.
getComponentAt
(
id
);
tabbedPane
.
setSelectedIndex
(
id
);
JPanel
panel
=
(
JPanel
)
openTabs
.
get
(
cls
);
if
(
panel
!=
null
)
{
panel
=
(
JPanel
)
openTabs
.
get
(
cls
);
tabbedPane
.
setSelectedComponent
(
panel
);
}
else
{
panel
=
newCodePane
();
tabbedPane
.
add
(
panel
);
int
id
=
tabbedPane
.
getTabCount
()
-
1
;
openTabs
.
put
(
cls
,
id
);
openTabs
.
put
(
cls
,
panel
);
int
id
=
tabbedPane
.
indexOfComponent
(
panel
);
tabbedPane
.
setTabComponentAt
(
id
,
makeTabComponent
(
cls
,
panel
));
tabbedPane
.
setSelectedIndex
(
id
);
tabbedPane
.
setTabComponentAt
(
id
,
makeTabComponent
(
cls
,
panel
,
id
));
}
if
(
panel
!=
null
)
{
JTextArea
textArea
=
getTextArea
(
panel
);
textArea
.
setText
(
cls
.
getCode
());
scrollToLine
(
textArea
,
line
);
}
JTextArea
textArea
=
getTextArea
(
panel
);
textArea
.
setText
(
cls
.
getCode
());
scrollToLine
(
textArea
,
line
);
}
private
Component
makeTabComponent
(
final
JClass
cls
,
final
Component
comp
,
final
int
id
)
{
private
Component
makeTabComponent
(
final
JClass
cls
,
final
Component
comp
)
{
String
name
=
cls
.
getCls
().
getFullName
();
JPanel
panel
=
new
JPanel
(
new
FlowLayout
(
FlowLayout
.
CENTER
,
3
,
0
));
panel
.
setOpaque
(
false
);
...
...
@@ -244,7 +241,8 @@ public class MainWindow extends JFrame {
if
(
e
.
getButton
()
==
MouseEvent
.
BUTTON2
)
{
closeCodeTab
(
cls
,
comp
);
}
else
{
tabbedPane
.
setSelectedIndex
(
id
);
// TODO: make correct event delegation to tabbed pane
tabbedPane
.
setSelectedComponent
(
comp
);
}
}
});
...
...
@@ -261,8 +259,8 @@ public class MainWindow extends JFrame {
}
private
void
scrollToLine
(
JTextArea
textArea
,
int
line
)
{
if
(
line
<
2
)
{
return
;
if
(
line
==
0
)
{
line
=
1
;
}
try
{
textArea
.
setCaretPosition
(
textArea
.
getLineStartOffset
(
line
-
1
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment