mirror of https://github.com/zlatinb/muwire
fix display of fetched profile image
parent
2c555f662a
commit
aea6d9b7d5
|
@ -7,6 +7,7 @@ import javax.imageio.ImageIO
|
|||
import javax.swing.JLabel
|
||||
import javax.swing.JPanel
|
||||
import javax.swing.JTextArea
|
||||
import javax.swing.SwingUtilities
|
||||
import javax.swing.border.TitledBorder
|
||||
import java.awt.BorderLayout
|
||||
import java.awt.Dimension
|
||||
|
@ -72,10 +73,12 @@ class ViewProfileView {
|
|||
gridLayout(rows: 1, cols: 2)
|
||||
panel(border: titledBorder(title: trans("PROFILE_VIEWER_AVATAR"), border: etchedBorder(),
|
||||
titlePosition: TitledBorder.TOP)) {
|
||||
gridLayout(rows: 1, cols: 1)
|
||||
imagePanel = panel()
|
||||
}
|
||||
panel(border: titledBorder(title: trans("PROFILE_VIEWER_PROFILE"), border: etchedBorder(),
|
||||
titlePosition: TitledBorder.TOP)) {
|
||||
gridLayout(rows: 1, cols: 1)
|
||||
scrollPane {
|
||||
bodyArea = textArea(editable: false, lineWrap: true, wrapStyleWord: true)
|
||||
}
|
||||
|
@ -123,10 +126,12 @@ class ViewProfileView {
|
|||
def rawImage = ImageIO.read(new ByteArrayInputStream(profile.getImage()))
|
||||
def mainImage = ImageScaler.scaleToMax(rawImage)
|
||||
|
||||
SwingUtilities.invokeLater {
|
||||
def imgDim = imagePanel.getSize()
|
||||
imagePanel.getGraphics().drawImage(mainImage,
|
||||
(int) (imgDim.getWidth() / 2) - (int) (mainImage.getWidth() / 2),
|
||||
(int) (imgDim.getHeight() / 2) - (int) (mainImage.getHeight() / 2),
|
||||
null)
|
||||
} as Runnable
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue