Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FUCoin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DistributedSystems4Students
FUCoin
Commits
a51bbee0
Commit
a51bbee0
authored
8 years ago
by
Luca Keidel
Browse files
Options
Downloads
Patches
Plain Diff
Removed unnecessary file
parent
c7c99b60
No related branches found
Branches containing commit
No related tags found
1 merge request
!5
Configuration system
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/Example.java
+0
-84
0 additions, 84 deletions
src/main/java/Example.java
with
0 additions
and
84 deletions
src/main/java/Example.java
deleted
100644 → 0
+
0
−
84
View file @
c7c99b60
import
java.awt.event.*
;
import
java.beans.PropertyChangeEvent
;
import
java.beans.PropertyChangeListener
;
import
javax.swing.*
;
@SuppressWarnings
(
"serial"
)
public
class
Example
extends
JFrame
{
public
Example
()
{
super
();
OuterView
theGUI
=
new
OuterView
();
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
setResizable
(
false
);
add
(
theGUI
);
pack
();
setVisible
(
true
);
}
public
static
void
main
(
String
[]
args
)
{
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
new
Example
();
}
});
}
}
class
OuterView
extends
JPanel
{
private
String
innerValue
=
""
;
public
OuterView
()
{
super
();
InnerView
innerPanel
=
new
InnerView
();
innerPanel
.
addPropertyChangeListener
(
new
PropertyChangeListener
()
{
@Override
public
void
propertyChange
(
PropertyChangeEvent
evt
)
{
if
(
evt
.
getPropertyName
().
equals
(
InnerView
.
COMBO_CHANGED
))
{
innerValue
=
evt
.
getNewValue
().
toString
();
System
.
out
.
println
(
"new value from inside of OuterView: "
+
innerValue
);
}
}
});
JButton
button
=
new
JButton
(
"display OuterView's model"
);
button
.
addActionListener
(
new
ButtonListener
());
add
(
innerPanel
);
add
(
button
);
}
private
class
ButtonListener
implements
ActionListener
{
@Override
public
void
actionPerformed
(
ActionEvent
ae
)
{
System
.
out
.
println
(
"button was clicked. innerValue: "
+
innerValue
);
}
}
}
class
InnerView
extends
JPanel
{
public
static
final
String
COMBO_CHANGED
=
"Combo Changed"
;
// private SwingPropertyChangeSupport pcSupport = new
// SwingPropertyChangeSupport(this);
String
oldValue
=
""
;
public
InnerView
()
{
super
();
String
[]
items
=
new
String
[]
{
"item 1"
,
"item 2"
,
"item 3"
};
JComboBox
comboBox
=
new
JComboBox
(
items
);
comboBox
.
addActionListener
(
new
ComboBoxListener
());
add
(
comboBox
);
}
private
class
ComboBoxListener
implements
ActionListener
{
@Override
public
void
actionPerformed
(
ActionEvent
ae
)
{
String
text
=
((
JComboBox
)
ae
.
getSource
()).
getSelectedItem
()
.
toString
();
firePropertyChange
(
COMBO_CHANGED
,
oldValue
,
text
);
oldValue
=
text
;
System
.
out
.
println
(
"store "
+
text
+
" in InnerView's model"
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment