mirror of
https://gitlab.com/biskuteri-cafe/JKomasto2.git
synced 2024-11-20 05:04:51 +01:00
Prepared functional hooks in PostWindow
This commit is contained in:
parent
13132c8fa9
commit
1704a22847
@ -83,6 +83,36 @@ implements ActionListener {
|
||||
repliesDisplay.setReplies(replies);
|
||||
}
|
||||
|
||||
public void
|
||||
openAuthorProfile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
favourite()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
boost()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
reply()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void
|
||||
openMedia()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// - -%- -
|
||||
|
||||
public void
|
||||
@ -119,7 +149,7 @@ implements ActionListener {
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
setLocationByPlatform(true);
|
||||
|
||||
postDisplay = new PostComponent();
|
||||
postDisplay = new PostComponent(this);
|
||||
|
||||
repliesDisplay = new RepliesComponent();
|
||||
|
||||
@ -152,7 +182,11 @@ implements ActionListener {
|
||||
|
||||
|
||||
class
|
||||
PostComponent extends JPanel {
|
||||
PostComponent extends JPanel
|
||||
implements ActionListener {
|
||||
|
||||
private PostWindow
|
||||
primaire;
|
||||
|
||||
private String
|
||||
author, time, text;
|
||||
@ -163,7 +197,7 @@ PostComponent extends JPanel {
|
||||
profile,
|
||||
favouriteBoost,
|
||||
replyMisc,
|
||||
prevNext,
|
||||
nextPrev,
|
||||
media;
|
||||
|
||||
// ---%-@-%---
|
||||
@ -191,6 +225,41 @@ PostComponent extends JPanel {
|
||||
|
||||
// - -%- -
|
||||
|
||||
public void
|
||||
actionPerformed(ActionEvent eA)
|
||||
{
|
||||
Object src = eA.getSource();
|
||||
|
||||
/*
|
||||
* Umm, ActionEvent is the wrong thing to listen for here.
|
||||
* We want mouse presses. The custom button would publish
|
||||
* events that mention which button it was.
|
||||
*
|
||||
* Default JButton ignores RMB.
|
||||
*/
|
||||
|
||||
if (src == profile)
|
||||
{
|
||||
primaire.openAuthorProfile();
|
||||
}
|
||||
else if (src == favouriteBoost)
|
||||
{
|
||||
// Fancy!!
|
||||
}
|
||||
else if (src == replyMisc)
|
||||
{
|
||||
|
||||
}
|
||||
else if (src == nextPrev)
|
||||
{
|
||||
|
||||
}
|
||||
else if (src == media)
|
||||
{
|
||||
primaire.openMedia();
|
||||
}
|
||||
}
|
||||
|
||||
protected void
|
||||
paintComponent(Graphics g)
|
||||
{
|
||||
@ -230,32 +299,39 @@ PostComponent extends JPanel {
|
||||
|
||||
// ---%-@-%---
|
||||
|
||||
PostComponent()
|
||||
PostComponent(PostWindow primaire)
|
||||
{
|
||||
this.primaire = primaire;
|
||||
|
||||
author = time = text = "";
|
||||
|
||||
profile = new JButton("P");
|
||||
profile.setSize(40, 40);
|
||||
profile.addActionListener(this);
|
||||
|
||||
favouriteBoost = new JButton("☆/B");
|
||||
favouriteBoost.setSize(40, 40);
|
||||
favouriteBoost.addActionListener(this);
|
||||
// We have to overload the buttons to accept RMBs.
|
||||
// Which perform the secondary functionality.
|
||||
|
||||
replyMisc = new JButton("R");
|
||||
replyMisc.setSize(40, 40);
|
||||
replyMisc.addActionListener(this);
|
||||
|
||||
prevNext = new JButton("↓/↑");
|
||||
prevNext.setSize(40, 40);
|
||||
nextPrev = new JButton("↓/↑");
|
||||
nextPrev.setSize(40, 40);
|
||||
nextPrev.addActionListener(this);
|
||||
|
||||
media = new JButton("M");
|
||||
media.setSize(40, 40);
|
||||
media.addActionListener(this);
|
||||
|
||||
setLayout(null);
|
||||
profile.setLocation(8, 8); add(profile);
|
||||
favouriteBoost.setLocation(8, 8+48); add(favouriteBoost);
|
||||
replyMisc.setLocation(8, 8+48+48); add(replyMisc);
|
||||
prevNext.setLocation(8, 8+48+48+48); add(prevNext);
|
||||
nextPrev.setLocation(8, 8+48+48+48); add(nextPrev);
|
||||
media.setLocation(8, 8+48+48+48+48); add(media);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user