try (PreparedStatement ps=conn.prepareStatement(QueryMapper.SCHEDULE_APPLICANT_STATUS)) {
ps.setString(1,schedule_id);
try (ResultSet rs = ps.executeQuery()) {
// or maybe if (rs.next())?
while (rs.next()) {
Application applicationBean= new Application();
System.out.println("ABC"+schedule_id);
applicationBean.setScheduledProgramId(rs.getString(3));
applicationBean.setStatus(rs.getString(2));
applicationBean.setApplicantId(rs.getString(1));
applicationList.add(applicationBean);
applicationCount++;
}
}
} catch (SQLException sqlException) {
log.error(sqlException.getMessage());
System.out.println(sqlException.getMessage());
}
我试图将注册按钮和登录按钮都放在窗口中间(位于注册按钮的位置),但要并排放置,而不是堆叠在一起。
对于此问题的格式不正确或代码的任何简单修复表示歉意。我是Tkinter的超级新手,正在尝试找出问题:)
答案 0 :(得分:0)
将“登录”按钮放在第1列中时,所有其他小部件都在第0列中,因此“登录”按钮将显示在最右边。
一种解决方案是为按钮创建一个contaner框架,将其放置在第0列的中心,然后将按钮放置在该框架的顶部。
我已经为所有小部件明确地指定了row和colun,这使得它更易于跟随,并且还为buttonFrame分配了bg颜色,以便您查看它的去向。
import random
from tkinter import *
root = Tk()
FirstPageFrame = Frame(root) # CREATES FIRST PAGE FRAME
FirstPageFrame.pack() # CREATES FIRST PAGE FRAME
RolltheDiceTitle = Label(FirstPageFrame, text="Roll the Dice")
RolltheDiceTitle.config(font=("Courier", 30))
RolltheDiceTitle.grid(row=0, column=0)
LoginRegisterWelcomeMessage = Label(FirstPageFrame, text="Welcome to the Roll the Dice Game.")
LoginRegisterWelcomeMessage.grid(row=1, column=0, padx=10, pady=10)
DiceImage = PhotoImage(file="dice.png")
DiceImageLabel = Label(FirstPageFrame, image=DiceImage)
DiceImageLabel.grid(row=2, column=0)
# Here is the container frame for the buttons.
buttonFrame = Frame(FirstPageFrame, bg='tan') # bg color to indicate
buttonFrame.grid(row=3) # position and extent of frame
registerButton = Button(buttonFrame, text="Register", fg="orange") # CREATES REGISTER BUTTON
registerButton.grid(row=0, column=0, padx=10, pady=10)
loginButton = Button(buttonFrame, text="Login", fg="Green") # CREATES LOGIN BUTTON
loginButton.grid(row=0, column=1, padx=10, pady=10)
root.mainloop() # Continues tkinter window loop so program does not close